Support up to pandas 3 - #100
Merged
Merged
Conversation
Static review and the test suite show no pandas 3 blockers: no removed APIs, no chained assignment (Copy-on-Write safe), all .map() usage is on Series, and legacy pickled dataframes still load. Verified by running the test suite under pandas 2.0.3 and 3.0.3. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HuteAomkhXVg2b5vco62Xw
pip install . does not run the custom setup.py install hook that installs lib/maxvolpy, so test collection failed with ModuleNotFoundError for test_activelearning and test_activeexploration. Install it explicitly after the main package. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HuteAomkhXVg2b5vco62Xw
UnitCellFilter moved from ase.constraints to ase.filters in ase 3.23; try the new location first and fall back for older ase. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HuteAomkhXVg2b5vco62Xw
Contributor
Author
|
There's some drive-by fixes for the CI too. Not sure if those were only important for my repo or also here. |
3 tasks
Bring in master and drop this branch's now-redundant copies of the two CI fixes, leaving the pandas bound as its only net change. This branch (15 Jul) found both CI problems before ICAMS#104 did and carried its own fixes for them, so master and this branch fixed the same two things independently and both files conflicted: * .github/workflows/test.yml - both add an "Install maxvolpy" step. Resolved to master's: it installs `Cython scipy` rather than only `cython`, and spells out why --no-build-isolation is needed. * tests/test_PyACECalculator.py - both wrap the UnitCellFilter import. Identical logic, only comment placement differed; resolved to master's. Both files are now byte-identical to master, so the net diff against master is the single setup.py line this PR is actually about. Verified the pandas audit rather than assuming it: * No use of APIs dropped in pandas 2/3 - no applymap, iteritems, delim_whitespace, .ix, get_values or lookup anywhere. Every `.append(` hit is a plain list; preparedata.py:706 appends to a list and then calls pd.concat, which is the modern pattern. * The `>=2` floor holds. paralleldataexecutor.py:68 looked like a DataFrame.map (pandas 2.1+) risk given the `batch_df` name, but the call is guarded by `isinstance(batch_df, pd.Series)` and DataFrames take the `.apply(..., axis=1)` branch, so nothing needs 2.1. * No chained assignment on DataFrames; writes go through df[col] = or df.loc[mask, col] =. The inplace=True calls that do exist (drop, dropna, reset_index) are on owned frames, not slices. * All 12 pickled frames in the repo load under pandas 3.0.5 / numpy 2.5.2, not just the exmpl_df cited in the PR. Nine of them are pyace.preparedata.DataFrameWithMetadata, a pd.DataFrame subclass with _metadata and a _constructor override - the part most exposed to pandas 3 - and they rebuild with the metadata attribute intact and object dtypes preserved. index.map(str), Series.map(len), df[col] =, df.loc[mask, col] = and pd.concat all run clean on the loaded frames with no CoW warnings. Caveat: a green run here does not exercise pandas 3, for two independent reasons. pandas 3.0 requires Python >= 3.11 and this matrix is 3.9/3.10, so it cannot be installed at all; and TensorPotential pins pandas<=2.0 and is installed first, so both jobs resolve pandas 2.0.0 whichever bound this file carries. CI can only show no regression against pandas 2.0.0. Same shape of gap as ICAMS#101 has for numpy. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Thank you for contributing to our project! Please review the checklist and fill out the details below.
Description of Changes
Widens the pandas requirement in setup.py from pandas<=2.0 to pandas>=2,<4, covering the whole pandas 2.x and 3.x series.
The codebase was audited for pandas 3 blockers; none were found:
Also installs the vendored lib/maxvolpy explicitly in the test workflow: pip install . does not run the custom setup.py install hook, so test_activelearning/test_activeexploration failed collection in CI with ModuleNotFoundError: maxvolpy.
Checklist
License Agreement
By submitting this pull request, I agree that:
Thank you for your contribution!