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

v0.13.2: NumPy 2.0 compatibility by using two import routes for VisibleDeprecationWarning #525

Merged
merged 6 commits into from
Sep 24, 2024

Conversation

hakonanes
Copy link
Member

@hakonanes hakonanes commented Sep 23, 2024

Description of the change

The only place orix's code is incompatible with NumPy v2 is the importing of VisibleDeprecationWarning from the top namespace. This was removed in v2. The replacement, exceptions.VisibleDeprecationWarning, was added in v1.25. To support NumPy older and newer, I've added both import attempts in orix.constants, making the warning available internally via this module.

diffpy.structure just made a pre-release v3.2.2rc0 which supports NumPy 2.0 (here on PyPI). With this PR, orix is also compatible with NumPy 2.0. orix is still compatible with diffpy.structure >= 3.0.2, and we don't need to increase this.

I suggest to make a patch release v0.13.2 within the next few days after this PR is merged into main.

Progress of the PR

For reviewers

  • The PR title is short, concise, and will make sense 1 year later.
  • New functions are imported in corresponding __init__.py.
  • New features, API changes, and deprecations are mentioned in the unreleased
    section in CHANGELOG.rst.
  • Contributor(s) are listed correctly in __credits__ in orix/__init__.py and in
    .zenodo.json.

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
…umpy

Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@hakonanes hakonanes added the dev Package maintenance label Sep 23, 2024
@hakonanes hakonanes added this to the v0.13.2 milestone Sep 23, 2024
@hakonanes hakonanes mentioned this pull request Sep 23, 2024
@hakonanes hakonanes linked an issue Sep 23, 2024 that may be closed by this pull request
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@pc494
Copy link
Member

pc494 commented Sep 24, 2024

Description of the change

The only place orix's code is incompatible with NumPy v2 is the importing of VisibleDeprecationWarning from the top namespace. This was removed in v2. The replacement, exceptions.VisibleDeprecationWarning, was added in v1.25. To support NumPy older and newer, I've added both import attempts in orix.constants, making the warning available internally via this module.

diffpy.structure just made a pre-release v3.2.2rc0 which supports NumPy 2.0 (here on PyPI). With this PR, orix is also compatible with NumPy 2.0. orix is still compatible with diffpy.structure >= 3.0.2, and we don't need to increase this.

Just to be clear, orix would have two installation options:

Path one, full fresh install

pip install orix

takes numpy2 and this new diffpy version.

Path 2, on a legacy install which already has numpy1 would install orix correctly (at 0.13.2) with no issues?

@hakonanes
Copy link
Member Author

Yes

@pc494
Copy link
Member

pc494 commented Sep 24, 2024

Yes

great! I'll review. I think we should be numpy2 only at some point, but probably not just yet...

Copy link
Member

@pc494 pc494 left a comment

Choose a reason for hiding this comment

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

Good stuff! Merging.

@pc494 pc494 merged commit dbb4c7e into pyxem:main Sep 24, 2024
12 checks passed
@hakonanes hakonanes deleted the use-numpy-exceptions branch September 24, 2024 15:58
@hakonanes
Copy link
Member Author

Thanks! I checked locally, and with this PR, diffpy.structure v3.2.2rc0, and NumPy v2, all tests ran fine.

@hakonanes
Copy link
Member Author

I'll publish the patch release v0.13.2 then.

@hakonanes
Copy link
Member Author

Hm, well, perhaps wait a few days until diffpy.structure v3.2.2 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev Package maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Numpy 2.0.0 problems
2 participants