Exposing registered components via entry points. #12482
-
I would like to include a custom-registered function within a config.cfg without having to have users pass in the code for these registered functions to the training CLI via the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
There is not a separate registry for components because components are just a wrapper for factory registry entries. However the entry points behavior is pretty confusing because:
So with this code + entry point, you'll end up with a factory for the name from spacy import Language
@Language.component("my_component")
def my_method(doc):
return doc spacy_factories =
_some_unused_name = my_package.components:my_method The component would also have been registered in the same way if you'd added this as an entry point in This is pretty confusing (I was initially not 100% sure without testing this out), we should add some better examples to the docs... |
Beta Was this translation helpful? Give feedback.
There is not a separate registry for components because components are just a wrapper for factory registry entries.
However the entry points behavior is pretty confusing because:
So with this code + entry point, you'll end up with a factory for the name
my_component
: