Skip to content

Conversation

danielhollas
Copy link
Collaborator

@danielhollas danielhollas commented May 27, 2025

Looks like numpy 2.x just....works?

(we should still probably wait before merging this until after release 2.7 just to be on the safe side, and we can then release in 2.7.1?)

See #6898

Warning from docs build, no idea where it comes from since we don't reference numpy.bool anywhere. I've added numpy.bool to nitpicks-exceptions

/home/docs/checkouts/readthedocs.org/user_builds/aiida-core/checkouts/6899/src/aiida/orm/nodes/data/base.py:docstring of aiida.orm.nodes.data.base.to_aiida_type:1: WARNING: py:class reference target not found: numpy.bool

Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.13%. Comparing base (1229ddd) to head (4d11a35).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6899      +/-   ##
==========================================
- Coverage   79.14%   79.13%   -0.01%     
==========================================
  Files         565      565              
  Lines       43394    43394              
==========================================
- Hits        34342    34334       -8     
- Misses       9052     9060       +8     

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

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

@danielhollas danielhollas changed the title WIP: Testing numpy 2.x Support numpy 2.x May 27, 2025
@danielhollas danielhollas marked this pull request as ready for review May 27, 2025 22:48
Copy link
Collaborator Author

@danielhollas danielhollas May 27, 2025

Choose a reason for hiding this comment

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

Hmm, looks like updating numpy in the lockfile had a cascading effect, here's the relevant diff

@@ -43,7 +44,8 @@ dependencies = [
     { name = "kiwipy", extra = ["rmq"] },
-    { name = "numpy" },
+    { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },
+    { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" },
     { name = "paramiko" },
     { name = "pgsu" },

I just ran uv lock --upgrade-package numpy

@danielhollas danielhollas mentioned this pull request May 27, 2025
Copy link
Contributor

@agoscinski agoscinski left a comment

Choose a reason for hiding this comment

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

I here trust uv doing the right thing (and the tests picking up bugs due to numpy changes), the changes in environment.yml and pyproject.toml seem fine.

@agoscinski
Copy link
Contributor

@danielhollas I am a bit concerned that in the future we might add functionalities that are only v2 only. By theses changes there are no tests anymore for numpy v1. Isn't it better to still test with v1 and use the ruff linting rule https://docs.astral.sh/ruff/rules/numpy2-deprecation/ to test if we use functionalities that are deprecated in v2?

@danielhollas
Copy link
Collaborator Author

@danielhollas I am a bit concerned that in the future we might add functionalities that are only v2 only. By theses changes there are no tests anymore for numpy v1.

That's a fair point, but your concern is not actually specific to numpy, in principle we have the same issue for all packages. Fortunately, uv resolver has an option where you can run it so that it picks the minimum versions (instead of higher versions). So I would suggest we add a new test job that will cover this. I am happy to do it. I would prefer to do it in a separate PR and merge this one ASAP, as I think it would be beneficial if people started testing with numpy 2.0.

and use the ruff linting rule https://docs.astral.sh/ruff/rules/numpy2-deprecation/ to test if we use functionalities that are deprecated in v2?

Good idea! LMK if you want me to do that here or in a new PR.

@danielhollas
Copy link
Collaborator Author

and use the ruff linting rule https://docs.astral.sh/ruff/rules/numpy2-deprecation/ to test if we use functionalities that are deprecated in v2?

Ah, I see you've already done that, thanks!

@agoscinski
Copy link
Contributor

agoscinski commented Jul 10, 2025

ok! will change to numpy v1, run CI and then merge.

@agoscinski
Copy link
Contributor

agoscinski commented Jul 10, 2025

@giovannipizzi mentioned to check if we align with official numpy recommandation guidelines for software dependencies as menitoned in AEP 003, referencing NEP 0029 which was superseeded by SPEC 0000. Anyway topic for another PR

EDIT: It is now issue #6933

@danielhollas danielhollas merged commit 1e8cd0b into aiidateam:main Jul 10, 2025
33 checks passed
@danielhollas danielhollas deleted the support-numpy2 branch July 10, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants