Skip to content

Fix doc build #23514

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

Merged
merged 2 commits into from
Jul 29, 2022
Merged

Fix doc build #23514

merged 2 commits into from
Jul 29, 2022

Conversation

tacaswell
Copy link
Member

PR Summary

Replaces #23508

The problem is a combination of:

  • the unit registry is managed by a dictionary at the module level of mpl.units
  • in sg 0.11 the default matplotlib reset reloads that module which (resets the registry). The motivation for this on their side was to make sure that the date formatter config did not leak between examples.
  • we have a local module (basic_units) that lives in the examples directory that we use for the unit examples
  • the first time it is imported the example units get registered
  • on the second import call Python grabs the module from sys.modules (so we do not get to run any code) but mpl.units has been reloaded so our example units are no longer registered

This PR fixes the issue by telling sg to also remove 'basic_units' from sys.modules so that it is effectively re-imported (and hence we register our selves) on each example. In contrast #23508 fixes this by adding an explict re-registration step to the examples.

The argument is favor of this PR is we do not require any changes to our examples and fixes the problem via the tool that broke. The argument in favor of #23508 is that it is maybe better pedagogically and explicit unit registration (rather than implicit on import) is better documentation anyway.

PR Checklist

Tests and Styling

  • [n/a] Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

@tacaswell tacaswell added this to the v3.5-doc milestone Jul 29, 2022
@tacaswell
Copy link
Member Author

As of sg 0.11 the unit registry is reset for each example.  This also forces
the basic_unit module to be fully re-imported to re-register in any example
that use it.
@QuLogic QuLogic merged commit e7c5290 into matplotlib:main Jul 29, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jul 29, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jul 29, 2022
@tacaswell tacaswell deleted the fix_doc_build branch July 29, 2022 20:40
QuLogic added a commit that referenced this pull request Jul 29, 2022
…514-on-v3.5.2-doc

Backport PR #23514 on branch v3.5.2-doc (Fix doc build)
QuLogic added a commit that referenced this pull request Jul 29, 2022
…514-on-v3.5.x

Backport PR #23514 on branch v3.5.x (Fix doc build)
@bjlittle bjlittle mentioned this pull request Aug 1, 2022
1 task
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.

3 participants