Isolate edsnlp entry points to prevent auto-import by spacy #235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #234
Since edsnlp 0.10.0, some of our components require optional dependencies (torch, transformers, etc).
By default,
pip install edsnlp
does not install these, so importing one of these components (e.g.,eds.transformer
) will fail.It is not an issue when building a pipeline via
edsnlp.blank(...)
since we only load entry points when required, so a user that does not add these components will face no issue. However, as demonstrated by #234, when usingspacy.blank
orspacy.load
spacy will look into all spacy_factories entry point and try to load them all, and fail when encountering one of the components mentioned previously.To solve that, we split our components between two namespaces,
spacy_factories
and a newedsnlp_factories
namespace : now spacy will only look in the first namespace, while edsnlp will look in both.Checklist