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

Adjust for mypy 1.11 #864

Merged
merged 5 commits into from
Jul 24, 2024
Merged

Adjust for mypy 1.11 #864

merged 5 commits into from
Jul 24, 2024

Conversation

khaeru
Copy link
Member

@khaeru khaeru commented Jul 23, 2024

This PR adjust for some type checking failures seen via CI upon the release of mypy 1.11. @glatterf42 identified that both were due to the new checking of arguments to partial().

Also:

  • The argument .operator.stacked_bar(…, dims=…) is adjusted to allow stacking 2+ dimensions, with an exception thrown if the argument is invalid. This corrects the appearance of the final plot in westeros_fossil_resource.ipynb, which previously had 'grade' on the ordinate.
  • Improve typing of .operator.as_message_df(). A different return type is indicated according to the wrap= argument.
  • Commit some changes to the westeros_report tutorial, as presented at the MESSAGE Workshop in June 2024.

How to review

Read the diff and note that the CI checks all pass.

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation. Type hints only.
  • Update release notes.

@khaeru khaeru added the ci Continuous integration label Jul 23, 2024
@khaeru khaeru self-assigned this Jul 23, 2024
@khaeru khaeru added this to the 3.10 milestone Jul 23, 2024
khaeru added 2 commits July 23, 2024 10:37
- These @overload decorations ensure that type checking of downstream
  code can identify the return type of the function according to the
  value of the wrap= argument.
- Confirm hints are usable by type checking the corresponding test
  function.
@glatterf42
Copy link
Member

Please note that I've also opened python/mypy#17569 to verify this change.

Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.6%. Comparing base (6b86116) to head (f1504e8).
Report is 33 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #864   +/-   ##
=====================================
  Coverage   95.6%   95.6%           
=====================================
  Files         46      46           
  Lines       4333    4344   +11     
=====================================
+ Hits        4143    4154   +11     
  Misses       190     190           
Files with missing lines Coverage Δ
message_ix/report/__init__.py 100.0% <100.0%> (ø)
message_ix/report/operator.py 97.5% <100.0%> (+0.2%) ⬆️
message_ix/report/pyam.py 100.0% <100.0%> (ø)
message_ix/tests/report/test_operator.py 100.0% <100.0%> (ø)

- Simplify use of helper functions.
- Use subscript notation for dimensionality of
  quantities, consistent with MESSAGE internal
  docs.
- Add example output from Reporter.visualize().
@khaeru khaeru added the tutorials Westeros and Austrian tutorials label Jul 23, 2024
Copy link
Member

@glatterf42 glatterf42 left a comment

Choose a reason for hiding this comment

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

All tests passing again, looks good to me :)

@khaeru khaeru merged commit 42ebec4 into main Jul 24, 2024
26 checks passed
@khaeru khaeru deleted the mypy-1.11 branch July 24, 2024 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration tutorials Westeros and Austrian tutorials
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants