Skip to content

Update to numpy 2.x#446

Merged
nvictus merged 7 commits intoopen2c:masterfrom
lrauschning:numpy-update
Dec 19, 2024
Merged

Update to numpy 2.x#446
nvictus merged 7 commits intoopen2c:masterfrom
lrauschning:numpy-update

Conversation

@lrauschning
Copy link
Copy Markdown
Contributor

Hi all,
updated the codebase to work with numpy 2.x .
Also had a look at the CI – the current CI failure seems to be caused by pypairix breaking on compile, commenting the dependency out makes it run. Have submitted an issue there and propose adding it again when that is fixed.
Currently, some test cases in test_cli_ingest.py and test_create_ingest.py are returning different values than stored in tests/data.
Not sure what's causing that, as the numpy update shouldn't change behaviour in this way. Might be the missing pypairix dependency, or an earlier change that wasn't noticed due to the general CI failure?
In a local pipeline using cooler I don't see any changes, so I think this should be fine to merge anyways, though it would be nice to get CI passing.
Cheers and happy winter holidays,
Leon

@nvictus
Copy link
Copy Markdown
Member

nvictus commented Dec 18, 2024

Thank you for the PR and thank you for submitting the issue upstream!

I'm currently traveling but will look into the odd test cases when I have some time.

@lrauschning
Copy link
Copy Markdown
Contributor Author

Thanks, have a nice winter break!

@nvictus
Copy link
Copy Markdown
Member

nvictus commented Dec 19, 2024

The test errors were actually caused by a strange behavioral change starting in numpy 2.1. Applying np.array() to a pandas Series no longer produces a proper copy of the data even when copy=True. As a result, some in-place operations on the array were mutating the underlying dataframe. This seems like a bug, though perhaps numpy's semantics of "shallow" copying have changed.

I switched to the pandas method Series.to_numpy(copy=True), which guarantees a true copy.

@nvictus
Copy link
Copy Markdown
Member

nvictus commented Dec 19, 2024

the current CI failure seems to be caused by pypairix breaking on compile, commenting the dependency out makes it run. Have submitted an issue there and propose adding it again when that is fixed.

I agree with dropping pairix from the [all] extra until a fix is released. FWIW, this PR seems to resolve the compilation issue, at least for me.

@nvictus nvictus merged commit 03f781f into open2c:master Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants