Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolate edsnlp entry points to prevent auto-import by spacy #235

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

percevalw
Copy link
Member

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 using spacy.blank or spacy.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 new edsnlp_factories namespace : now spacy will only look in the first namespace, while edsnlp will look in both.

Checklist

  • If this PR is a bug fix, the bug is documented in the test suite.
  • Changes were documented in the changelog (pending section).
  • If necessary, changes were made to the documentation (eg new pipeline).

@percevalw percevalw force-pushed the fix-non-ml-install branch 2 times, most recently from a1107ba to 0102518 Compare December 13, 2023 17:29
Copy link

codecov bot commented Dec 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c918130) 96.58% compared to head (8134c30) 96.59%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #235   +/-   ##
=======================================
  Coverage   96.58%   96.59%           
=======================================
  Files         254      254           
  Lines        8356     8341   -15     
=======================================
- Hits         8071     8057   -14     
+ Misses        285      284    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@percevalw percevalw force-pushed the fix-non-ml-install branch 2 times, most recently from cbca60c to f602241 Compare December 13, 2023 18:45
@percevalw percevalw merged commit 72fdfc4 into master Dec 14, 2023
10 checks passed
@percevalw percevalw deleted the fix-non-ml-install branch December 14, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Edsnlp is interferring with spacy default behavior, and requires "trainable" dependencies
2 participants