Add support for Python3.14, drop support for 3.9 and 3.10#826
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates MUSE’s supported Python/runtime stack to accommodate newer versions of core scientific dependencies (notably pandas/xarray), adding Python 3.14 support while dropping Python 3.9/3.10. It also adjusts xarray concatenation/merge behavior and refreshes CI/docs to match the new support window.
Changes:
- Update Python support metadata (pyproject classifiers /
requires-python) and refresh CI + ReadTheDocs + installation docs to Python 3.11–3.14. - Update xarray
concat(...)/merge(...)calls to set explicit join/compat/coords/data_vars behavior (and adjust tests accordingly). - Minor test/data-selection updates (e.g., pandas
.isin(...)usage) and warning filtering cleanup.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Raises minimum Python to 3.11, adds 3.14 classifier, updates dependency bounds. |
src/muse/utilities.py |
Adds explicit xr.concat parameters to stabilize concat behavior under newer xarray. |
src/muse/filters.py |
Refactors initializer asset indexing logic (potentially problematic). |
src/muse/readers/csv.py |
Uses join="outer" for merges to handle newer xarray merge defaults. |
src/muse/readers/toml.py |
Uses join="outer" when merging trade data into technodata. |
tests/test_timeslice_output.py |
Adjusts filtering to use .isin(...) for technology selection. |
tests/test_demand_share.py |
Adds explicit xr.concat parameters. |
tests/conftest.py |
Removes a Python 3.9-specific warning ignore. |
docs/installation/virtual-env-based.rst |
Updates example Python version and minor text edit. |
docs/installation/pipx-based.rst |
Updates stated compatible Python versions and pyenv examples. |
.readthedocs.yaml |
Bumps docs build Python to 3.11. |
.github/workflows/ci.yml |
Updates test matrix to 3.11/3.14 and Codecov gating. |
.github/workflows/regression_tests.yml |
Updates regression test matrix to 3.11/3.14. |
.github/workflows/publish.yml |
Updates standalone build Python to 3.11. |
.github/workflows/documentation.yml |
Bumps docs workflow Python to 3.14. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) | ||
| assets = xr.ones_like( | ||
| reduce_assets(agent.assets.asset, coords=coords), dtype=bool | ||
| ).set_index(asset="technology") |
There was a problem hiding this comment.
Not sure. This is functionally equivalent to before so not introducing any new bugs at least. This function doesn't seem to be used anyway in any of the examples, so may be able to delete
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 49 out of 49 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/muse/utilities.py:440
nametuple_to_dictnow acceptstuple, but the fallback branch callsnametup.copy()and then iterates.items(), which will raise at runtime for a plaintuple(and any non-Mapping without_asdict). Consider narrowing the annotation back to a Mapping/NamedTuple-like type (e.g., a protocol exposing_asdict) or making the fallback explicitly validateisinstance(nametup, Mapping)and raise a clearTypeErrorotherwise.
Description
Updates dependencies to use the latest versions of pandas, xarray, numpy and scipy. As a result, I've had to drop support for Python 3.9 and 3.10 as these are not supported by the latest package versions. There are also a few syntax changes related to pandas and xarray (in particular, xarray was warning about upcoming changes to some default parameters, so I've set these explicitly to avoid unwanted behaviour changes).
As shown by pandas 3.0, it's likely that any further major version updates to these packages will break things, so I've capped the upper versions to prevent unwanted breakages (e.g. when pandas 4 comes out). Not sure why I wasn't doing this already, to be honest.
Since this is a major breaking change, I'll wait for the next major release (i.e. v1.6.0) to merge this, whenever the time comes.
Fixes #825
Type of change
Key checklist
$ python -m pytest$ python -m sphinx -b html docs docs/buildFurther checks