Skip to content

Conversation

@glatterf42
Copy link
Member

This PR aims to add support for Python 3.14. Since this already works in genno, we might also manage here already :)

In its structure, the PR is analogous to #132. Though when I ran poetry check to confirm the lock file was up to date with pyproject.toml, I received numerous DeprecationWarnings about poetry 2.0 having moved from the tool.poetry section to the standard project (see their docs for more details). Thus I took this opportunity to perform the migration, too.

@glatterf42 glatterf42 requested a review from meksor October 15, 2025 16:20
@glatterf42 glatterf42 self-assigned this Oct 15, 2025
@glatterf42 glatterf42 added the enhancement New feature or request label Oct 15, 2025
@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.3%. Comparing base (488ec2a) to head (b711f72).

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #209     +/-   ##
=======================================
- Coverage   93.3%   93.3%   -0.1%     
=======================================
  Files        256     256             
  Lines      10918   10932     +14     
=======================================
+ Hits       10193   10200      +7     
- Misses       725     732      +7     
Files with missing lines Coverage Δ
ixmp4/core/iamc/data.py 100.0% <100.0%> (ø)
ixmp4/core/run.py 100.0% <100.0%> (ø)
ixmp4/data/api/base.py 88.5% <100.0%> (+<0.1%) ⬆️
ixmp4/data/auth/context.py 95.3% <100.0%> (ø)
ixmp4/data/db/base.py 92.3% <100.0%> (-0.1%) ⬇️
ixmp4/data/db/iamc/datapoint/repository.py 98.1% <100.0%> (ø)
ixmp4/data/db/iamc/timeseries/repository.py 92.2% <100.0%> (ø)
ixmp4/data/db/meta/repository.py 97.8% <100.0%> (ø)
ixmp4/data/db/model/filter.py 86.0% <100.0%> (ø)
ixmp4/data/db/scenario/filter.py 67.4% <100.0%> (ø)
... and 2 more

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@glatterf42 glatterf42 force-pushed the enh/support-python3.14 branch 14 times, most recently from ff544df to 4d18057 Compare October 17, 2025 07:40
@glatterf42 glatterf42 force-pushed the enh/support-python3.14 branch 2 times, most recently from 6d7984f to 01072e2 Compare October 17, 2025 09:33
khaeru added a commit to iiasa/ixmp that referenced this pull request Oct 23, 2025
khaeru added a commit to iiasa/ixmp that referenced this pull request Oct 23, 2025
khaeru added a commit to iiasa/ixmp that referenced this pull request Oct 23, 2025
khaeru added a commit to iiasa/ixmp that referenced this pull request Oct 23, 2025
khaeru added a commit to iiasa/ixmp that referenced this pull request Oct 24, 2025
@glatterf42 glatterf42 force-pushed the enh/support-python3.14 branch 3 times, most recently from bb25f97 to 310e862 Compare November 18, 2025 11:28
@glatterf42 glatterf42 force-pushed the enh/support-python3.14 branch from 310e862 to aae1542 Compare November 18, 2025 12:29
@glatterf42 glatterf42 force-pushed the enh/support-python3.14 branch from 0ed907a to 36e8ce6 Compare November 18, 2025 12:52
@glatterf42 glatterf42 force-pushed the enh/support-python3.14 branch from 36e8ce6 to 01cb886 Compare November 18, 2025 15:13
run: poetry add pandas@${{ matrix.pandas-version }} [email protected] --lock

- name: Install pandera from GitHub for Python 3.14 supported
run: poetry add git+https://github.com/unionai-oss/pandera.git
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure how we want to handle this. It's mainly here to show that everything works now. I've asked the pandera maintainers if they have an ETA for a next release, but no reply so far. We can merge like this and keep it in mind (our dependencies already allow the next pandera release whenever it drops) for potential issues being opened, or we wait until we have the release and merge after dropping the "TEMPORARY" commit.

Comment on lines +140 to +145
# NOTE Somehow, the dtype of "step_datetime" and some other columns
# (datetime64[ns]) gets converted to "object" in pd.DataFrame(); convert back
if self.columns:
for name in {"step_datetime", "created_at", "updated_at"}:
if name in self.columns:
df[name] = pd.to_datetime(df[name])
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure why we had this construct of setting columns to themselves as different types, and it might not matter anyway with the big rewrite, but I found this erroneous: in some iamc tests ("test_run_datapoints_raw" or so), this function would receive a step_datetime columns of datetime64[ns] type, but find a dtype of object stored for it in self.dtypes, effectively replacing the correct type with a generic one.
This solution uses hardcoded names, which is not ideal either, but keeps the dtype correct.

Though it does retain the ChainedAssignmentError warning that it was supposed to address: the CI at least still shows this warning for line 145, but even though I use the same versions of pandas and pydantic locally, I can't replicate this (I do use Python 3.12 locally, not 3.14).
Using df.loc[:, name] = pd.to_datetime(df.loc[:, name]) does not resolve this warning, unfortunately.
But maybe the rewrite doesn't rely so much on these exact forms of assignment :)

@glatterf42 glatterf42 force-pushed the enh/support-python3.14 branch from 01cb886 to b711f72 Compare November 18, 2025 15:18
@glatterf42 glatterf42 requested review from meksor and removed request for meksor November 18, 2025 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant