Skip to content

Conversation

@khaeru
Copy link
Member

@khaeru khaeru commented Jul 3, 2025

pandas-stubs version 2.3.0 was released 2025-07-02 (lagging about a month behind pandas itself). This caused mypy errors here:

message_ix/macro.py:283: error: No overload variant of "apply" of "DataFrameGroupBy" matches argument types "Callable[[DataFrame], float]", "dict[str, bool]"  [call-overload]
message_ix/macro.py:283: note: Possible overload variants:
message_ix/macro.py:283: note:     def [P`17067] apply(self, DFCallable1[P], /, *args: P.args, **kwargs: P.kwargs) -> Series[Any]
message_ix/macro.py:283: note:     def [P`17068] apply(self, DFCallable2[P], /, *args: P.args, **kwargs: P.kwargs) -> DataFrame
message_ix/macro.py:283: note:     def [P`17069] apply(self, DFCallable3[P], /, *args: P.args, **kwargs: P.kwargs) -> DataFrame

The offending code was for compatibility with Python 3.8 and earlier, or at least with versions of pandas that would be installed for Python 3.8. Since this Python version is no longer supported, this PR drops the work-around, which makes the error disappear.

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. N/A, type checking only
  • Update release notes. Ditto.

- This version of Python is no longer supported.
- Satisfy mypy with pandas-stubs 2.3.0.
@khaeru khaeru self-assigned this Jul 3, 2025
@khaeru khaeru added the ci Continuous integration label Jul 3, 2025
@codecov
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.8%. Comparing base (99514bf) to head (08606f2).
⚠️ Report is 82 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #960     +/-   ##
=======================================
- Coverage   96.0%   95.8%   -0.3%     
=======================================
  Files         53      53             
  Lines       5028    5026      -2     
=======================================
- Hits        4831    4818     -13     
- Misses       197     208     +11     
Files with missing lines Coverage Δ
message_ix/macro.py 96.7% <ø> (-0.1%) ⬇️

... and 1 file with indirect coverage changes

@khaeru
Copy link
Member Author

khaeru commented Jul 3, 2025

The failing codecov/project check appears to be spurious.

@khaeru khaeru merged commit eea9340 into main Jul 3, 2025
47 of 52 checks passed
@khaeru khaeru deleted the fix/pandas-stubs-2.3.0 branch July 3, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant