I have a custom class that exposes a MongoDB database with the same API as Database, and I'm trying to make it accessible through an entry point.
For reference, here is my setup.py file for the package I'm writing.
setup(
name='mondigy',
version='0.1',
entry_points={
'console_scripts': ['mondigy = mondigy.__main__:main'],
'prodigy_loaders': ['mondigy.loader = mondigy.loader:mongo_loader'],
'prodigy_db': ['mondigy.db = mondigy.database:AnnotationDatabase']
}
)
mondigy/database.py contains a class called AnnotationDatabase that implements the Database API and mondigy/loader.py contains a recipe function as in the custom loader guide. However, when I try to start Prodigy with the mongo database loader and mongo database, I see a bunch of examples from my MongoDB printed and it throws the following error:
Traceback (most recent call last):
File "/Users/jdagdelen/opt/anaconda3/envs/prodigy/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/Users/jdagdelen/opt/anaconda3/envs/prodigy/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/jdagdelen/opt/anaconda3/envs/prodigy/lib/python3.6/site-packages/prodigy/main.py", line 60, in
controller = recipe(*args, use_plac=True)
File "cython_src/prodigy/core.pyx", line 231, in prodigy.core.recipe.recipe_decorator.recipe_proxy
File "cython_src/prodigy/core.pyx", line 71, in prodigy.core.Controller.init
File "cython_src/prodigy/core.pyx", line 189, in prodigy.core.Controller.connect_db
TypeError: argument of type 'type' is not iterable
It seems like it expects the database class to be iterable?
The documentation on using entry points seems to be thinner on the new documentation site than it used to be in the README.html. Can someone share the relevant section from the old documentation?