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
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.
I never knew about the
entry_points feature. Thanks.
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.
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.