Feature request: -F should load custom recipes from PYTHONPATH

enhancement

(W.P. McNeill) #1

In addition to an explicit path to the custom recipe code, prodigy -F should also load from PYTHONPATH. That way if I have a custom recipe in a file called custom_recipe.py installed as part of my_package the user can run the command line

progidy custom.recipe -F my_package.custom_recipe

without having to specify a path into the site-packages directory.


(Ines Montani) #2

Thanks, I’m glad you mentioned this – we’ve actually been thinking about something similar! Our idea was to work with entry points. Your package could then define its recipes in the entry_points, which would even let you drop the -F argument completely. It’d also allow more complex and versioned recipe management, especially for larger teams using Prodigy.

I’ll also experiment with the PYTHONPATH solution, though – this could be a nice and simple addition in the meantime. If -F is a valid path, Prodigy uses importlib to load the recipe a file as a module. So in the case you describe, we could just skip that step and try to import it directly if it exists.


Template for Prodigy corpus and API loaders
(W.P. McNeill) #3

I never knew about the entry_points feature. Thanks. :slight_smile:

For my scenario entry points is probably better than PYTHONPATH since I’m trying to do things the official setup.py way. If you do implement this, you’d want to mention it in the Prodigy documentation, since I’ll bet there are other people like me who didn’t know that entry_points was a thing.


(Spencer) #4

The entry points are interesting. If it is any easier, I would also be cool setting a recipe directory or individual recipe paths in prodigy.json.