-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Lazily load cli with module __getattr__ #13721
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
base: master
Are you sure you want to change the base?
Conversation
Well this does not work quite yet. |
Okay now it's better. |
Hi @adrianeboyd, spacy + pyodide still blocked on this and wondering if you could take a look! Thanks (and also to hoodmane) |
Would a comment like
be appropriate for And for curiosity, is |
Yes. And |
@adrianeboyd Another ping on this (as it's been two months) :) |
@nro-bot Sorry for the lack of attention on this. Adriane no longer works at Explosion (we're no longer venture-backed), and my time for support has been split over a lot of different things. I'm now getting more on top of it, having just finished the support for Python 3.13. Could you summarise a little more what the lazy loading is intending to do? Is it that you want to avoid the import of the pipeline at loading, so that you can avoid triggering stuff that doesn't work? An issue with the lazy-loading is that spaCy heavily depends on entry-points. These end up importing everything to get decorators to run as side-effects. I've refactored this in the patch for 3.13, so we no longer rely on these import side-effects to run decorators. That said, the registration functions (which need to run to do anything much) still need to import pretty much everything. So it's not clear to me what the net impact for your use-case would be. |
Yeah that's what we're after.
The test here works fine with this patch: |
This is a reland of #12962. That PR broke accesses to
spacy.cli
:This avoids such a problem by using module
__getattr__
.