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

Upgrade matplotlib and fix mypy errors #653

Merged
merged 2 commits into from
Oct 22, 2024
Merged

Conversation

alexdewar
Copy link
Collaborator

Description

This PR upgrades matplotlib to 3.9.2 and fixes the somewhat odd type errors that came with it. The code looked fine to me, but apparently we were falling foul of the type checker by freely converting between np.ArrayLike objects and lists, even though the code itself worked fine. I considered just suppressing the errors here, but it seemed a bit cleaner to just yield to mypy and use np.arrays instead of lists.

Fixes #644.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Documentation (non-breaking change that adds or improves the documentation)
  • Optimisation (non-breaking, back-end change that speeds up the code)

Key checklist

  • Pre-commit hooks run successfully (pre-commit run -a)
  • All tests pass (pytest)
  • The documentation builds without warnings (mkdocs build -s)
  • Check the GUI still works (if relevant)
  • Check the code works with actual hardware (if relevant)
  • Check the pyinstaller-built executable works (if relevant)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests have been added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

@alexdewar alexdewar requested review from dc2917 and dalonsoa October 16, 2024 16:22
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 10.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 84.80%. Comparing base (fdf0736) to head (8fa6c45).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
finesse/gui/temperature_plot.py 10.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #653      +/-   ##
==========================================
+ Coverage   84.67%   84.80%   +0.12%     
==========================================
  Files          69       69              
  Lines        3452     3448       -4     
==========================================
+ Hits         2923     2924       +1     
+ Misses        529      524       -5     

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

Copy link
Contributor

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we all love mypy...

@alexdewar
Copy link
Collaborator Author

@dc2917 It would be handy to have your review on this as the original author of the matplotlib bits.

Copy link
Contributor

@dc2917 dc2917 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sensible to me, and works as expected

@alexdewar
Copy link
Collaborator Author

Thanks @dc2917 !

@alexdewar alexdewar merged commit 3914008 into main Oct 22, 2024
9 checks passed
@alexdewar alexdewar deleted the fix-matplotlib-mypy-errors branch October 22, 2024 07:51
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.

mypy fails with matplotlib v3.9
3 participants