iiasa / message_ix

The integrated assessment and energy systems model MESSAGEix
https://docs.messageix.org
Apache License 2.0
111 stars 149 forks source link

Ensure compatibility with pandas CoW #842

Closed glatterf42 closed 1 month ago

glatterf42 commented 1 month ago

Closes #804. This PR temporarily enables the pandas Copy-on-Write behaviour that will become standard with pandas 3.0. With this, I ran all tests locally to study the warnings we would get from this: only two files were affected, add_year/__init__ and macro. Then, I fixed all of these warnings as suggested in the migration guide, so we might be good with this repo (and all underlying ixmp functions called from the test suite here) :)

How to review

PR checklist

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 71.59091% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 95.6%. Comparing base (4207f5c) to head (4913c24). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #842 +/- ## ======================================= + Coverage 95.4% 95.6% +0.1% ======================================= Files 46 46 Lines 4354 4339 -15 ======================================= - Hits 4156 4149 -7 + Misses 198 190 -8 ``` | [Files](https://app.codecov.io/gh/iiasa/message_ix/pull/842?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iiasa) | Coverage Δ | | |---|---|---| | [message\_ix/macro.py](https://app.codecov.io/gh/iiasa/message_ix/pull/842?src=pr&el=tree&filepath=message_ix%2Fmacro.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iiasa#diff-bWVzc2FnZV9peC9tYWNyby5weQ==) | `96.7% <100.0%> (+<0.1%)` | :arrow_up: | | [message\_ix/tools/add\_year/\_\_init\_\_.py](https://app.codecov.io/gh/iiasa/message_ix/pull/842?src=pr&el=tree&filepath=message_ix%2Ftools%2Fadd_year%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iiasa#diff-bWVzc2FnZV9peC90b29scy9hZGRfeWVhci9fX2luaXRfXy5weQ==) | `66.8% <70.9%> (+0.6%)` | :arrow_up: |
glatterf42 commented 1 month ago

Not sure why codecov/patch registers a diff hit, we test the same functions as before. So I'm fine with the hit if that comes from additional lines that reduce complexity. I'll rebase to exclude the TEMPORARY commit and merge once the tests pass (again).