Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Add explicit registration of units in examples#23508
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Starting insphinx-gallery/sphinx-gallery#890,sphinx-gallery started clearing Matplotlib's unit registry. But since`basic_units` was already imported, its register-on-import neverhappened for subsequent examples, breaking them.
| units.registry[BasicUnit]=units.registry[TaggedValue]=BasicUnitConverter() | ||
| defregister_units(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm still a little tan about who is incorrect here. It really seems sphinx gallery should spawn a new process for each example so the import happens again. However, I can see why that would be slow. It does make me extremely suspicious about changing behaviour via a registry that gets set at import time like this... (and yes we do it internally for dates and categorical as well).
tacaswell left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think I see a better path usinghttps://sphinx-gallery.github.io/stable/advanced.html#resetting-before-each-example
QuLogic commentedJul 30, 2022
Replaced by#23514. |
PR Summary
Starting insphinx-gallery/sphinx-gallery#890, sphinx-gallery started clearing Matplotlib's unit registry. But since
basic_unitswas already imported, its register-on-import never happened for subsequent examples, breaking them.PR Checklist
Tests and Styling
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).Documentation
doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).