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

fix: compatibility with matplotlib 3.6 #366

Merged
merged 10 commits into from Sep 25, 2022
Merged

Conversation

alexander-held
Copy link
Member

@alexander-held alexander-held commented Sep 17, 2022

matplotlib 3.6 (overview) deprecates set_tight_layout and slightly changes figure layout, requiring updates to references. The new layout_engine module in matplotlib is however not available in earlier versions, and matplotlib 3.6 requires Python 3.8.

We need to check the version of matplotib to correctly handle versions <3.6 and >=3.6. Using .__version__ was confirmed as a safe approach to use for matplotlib. See also https://discuss.python.org/t/dynamic-versions-in-editable-installations/15220/56. When not using .__version__, the alternative approach to use should be importlib.metadata.version (or the importlib-metadata port).

The coverage is now evaluated with Python 3.8 (previously Python 3.7 was used) to focus on the behavior with the latest matplotlib version.

Since pyhf 0.7 brought another API change (scikit-hep/pyhf#2027) compared to RC4, pin to that RC temporarily for CI to work (will be relaxed again right afterwards via #367).

The RTD theme for Sphinx causes CI to fail in the latest version due to readthedocs/sphinx_rtd_theme#1343, so that version is also excluded explicitly to fix this.

* refactor deprecated use of set_tight_layout
* update reference figures to matplotlib 3.6
* handle API differences between matplotlib<3.6 (for Python 3.7) and matplotlib>=3.6
* temporarily pin pyhf==0.7.0rc4
* skip latest Sphinx version for which RTD theme is broken
* switch from Python 3.7 to 3.8 for coverage evaluation

@codecov
Copy link

codecov bot commented Sep 25, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (5bcfe24) compared to base (f0f9593).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #366   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines         2019      2023    +4     
  Branches       331       331           
=========================================
+ Hits          2019      2023    +4     
Impacted Files Coverage Δ
src/cabinetry/visualize/plot_model.py 100.00% <100.00%> (ø)
src/cabinetry/visualize/plot_result.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@alexander-held alexander-held merged commit 278d088 into master Sep 25, 2022
@alexander-held alexander-held deleted the fix/maptlotlib-3.6 branch September 25, 2022 17:24
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.

None yet

1 participant