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 support #205

Merged
merged 8 commits into from
Jun 20, 2024
Merged

Numpy 2.0 support #205

merged 8 commits into from
Jun 20, 2024

Conversation

aganders3
Copy link
Contributor

NumPy 2.0 is set to be released on June 16. I've been adding support in a couple other projects so figured I'd try to help out here if you're interested.

The process here was mainly to run the ruff plugin and fix what it caught. I used np.float64 where I needed to pick a float precision, because that seemed more common in your code.

I also added the optional dependencies I found when running tests as extras, so you can install them with pip install phidl[all] (or [test]). Then I updated a few places that were causing DeprecationWarnings.

Comment on lines 233 to 235
pytest.importorskip(
"phidl.font", reason="Testing of ttf/otf fonts requires the freetype package.",
exc_type=ImportError,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could go in a separate PR, and this might not be the correct solution.
https://docs.pytest.org/en/8.2.x/deprecations.html#import-or-skip-import-error

phidl/device_layout.py Outdated Show resolved Hide resolved
@amccaugh amccaugh changed the base branch from master to dev June 20, 2024 21:04
@amccaugh
Copy link
Owner

Thank you for the PR! I've made a few modifications to satisfy the tests but otherwise looks great!

@amccaugh amccaugh merged commit 220d992 into amccaugh:dev Jun 20, 2024
4 checks passed
@aganders3 aganders3 deleted the numpy-2.0-support branch June 20, 2024 21:20
@aganders3
Copy link
Contributor Author

Thanks! I'm not sure why pre-commit was not catching these issues locally for me but oh well.

Pour one out for Python 3.7 support.

@amccaugh
Copy link
Owner

No idea what was going wrong on the 3.7 but it was EOL anyway!

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