Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy 2.0 #388

Merged
merged 13 commits into from
Sep 30, 2024
Merged

numpy 2.0 #388

merged 13 commits into from
Sep 30, 2024

Conversation

AdamOrmondroyd
Copy link
Collaborator

@AdamOrmondroyd AdamOrmondroyd commented Jul 2, 2024

Description

Changes for compatibility with numpy 2.0

fixes #389
*TODO: change numpy restriction once #390 is merged and pytables is updated

Checklist:

  • I have performed a self-review of my own code
  • My code is PEP8 compliant (flake8 anesthetic tests)
  • My code contains compliant docstrings (pydocstyle --convention=numpy anesthetic)
  • New and existing unit tests pass locally with my changes (python -m pytest)
  • I have added tests that prove my fix is effective or that my feature works
  • I have appropriately incremented the semantic version number in both README.rst and anesthetic/_version.py

@AdamOrmondroyd AdamOrmondroyd marked this pull request as draft July 2, 2024 14:08
@williamjameshandley
Copy link
Collaborator

@DilyOng will likely be interested in @AdamOrmondroyd's observation PyTables/PyTables#1172, as she's been trying to use hdf5 recently without success.

@AdamOrmondroyd
Copy link
Collaborator Author

Provided numpy<2.0.0, hdf is working fine on my mac.

@AdamOrmondroyd AdamOrmondroyd mentioned this pull request Sep 12, 2024
6 tasks
Copy link

codecov bot commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (a4c8521) to head (5e97567).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #388   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           36        36           
  Lines         3069      3076    +7     
=========================================
+ Hits          3069      3076    +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lukashergt
Copy link
Collaborator

Thanks for this @AdamOrmondroyd!
I've restricted the CI sphinx check to numpy 1 for now.
What keeps this in draft mode?
How do we want to handle the lacking code coverage (which is coming from us trying to stay backwards compatible with numpy 1)? Should we add a single test suite that uses numpy 1?

@AdamOrmondroyd
Copy link
Collaborator Author

AdamOrmondroyd commented Sep 19, 2024

Thanks for this @AdamOrmondroyd! I've restricted the CI sphinx check to numpy 1 for now.

I think the test suite may have misled you. All the pytests involving fastkde skip rather than fail due to the failed import, which is a flaw in how our optional dependency tests work. Really, the "true" tests should fail.

What keeps this in draft mode?

I was waiting for fastkde to release a pypi update.

How do we want to handle the lacking code coverage (which is coming from us trying to stay backwards compatible with numpy 1)? Should we add a single test suite that uses numpy 1?

This should be covered by the minimum dependencies test, if it isn't that's a bug.

@williamjameshandley
Copy link
Collaborator

I agree that we should support numpy 1 -- given that it was non-zero work for @AdamOrmondroyd to upgrade our code, we shouldn't expect others to. Our test suite should check both cases, but we'll only need one numpy v1 case rather than the full grid

@AdamOrmondroyd
Copy link
Collaborator Author

Ah I see the problem - min_requirements doesn't do anything with <= requirements, should we define a minimum numpy and scipy?

…ll earlier versions did not want to install locally
@lukashergt
Copy link
Collaborator

I think the test suite may have misled you. All the pytests involving fastkde skip rather than fail due to the failed import, which is a flaw in how our optional dependency tests work. Really, the "true" tests should fail.

oh yeah, that is annoying... :/

@AdamOrmondroyd
Copy link
Collaborator Author

Do you have a favourite minimum scipy?

@AdamOrmondroyd
Copy link
Collaborator Author

Does some dark codecov magic need to happen?

@lukashergt
Copy link
Collaborator

lukashergt commented Sep 26, 2024

Do you have a favourite minimum scipy?

Nope... Leave it for now? Or go with the getdist requirement of scipy>=1.5?

Does some dark codecov magic need to happen?

Ah cr**, yeah, and I always forget what the right order of things to do is...

Comment on lines 24 to 28
reason = "requires fastkde package"
condition = 'fastkde' not in sys.modules
condition = find_spec('fastkde') is None
raises = ImportError
fastkde_mark_skip = pytest.mark.skipif(condition, reason=reason)
fastkde_mark_xfail = pytest.mark.xfail(condition, raises=raises, reason=reason)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change addresses the problem that @AdamOrmondroyd raised in a comment:

All the pytests involving fastkde skip rather than fail due to the failed import, which is a flaw in how our optional dependency tests work. Really, the "true" tests should fail.

With these changes the extras=true tests now fail, and the extras=false tests pass. Hopefully all tests pass once fastkde functions properly with numpy 2.0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just what we need, thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

works locally with the current main branch of fastkde, just need them to update it on pypi when they've fixed their ci

@AdamOrmondroyd AdamOrmondroyd marked this pull request as ready for review September 28, 2024 23:13
Copy link
Collaborator

@lukashergt lukashergt left a comment

Choose a reason for hiding this comment

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

Fantastic, many thanks @AdamOrmondroyd!

@AdamOrmondroyd AdamOrmondroyd merged commit 42b1ead into handley-lab:master Sep 30, 2024
22 checks passed
@AdamOrmondroyd AdamOrmondroyd deleted the numpy2 branch September 30, 2024 16:30
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.

pytables incompatible with numpy 2.0
3 participants