Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: Fix unit example so that we can unpin numpy<2.1 #29616

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

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ commands:
parameters:
numpy_version:
type: string
default: "~=2.0.0"
default: ""
steps:
- run:
name: Install Python dependencies
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
- kiwisolver>=1.3.1
- pybind11>=2.13.2
- meson-python>=0.13.1
- numpy<2.1
- numpy
- pillow>=9
- pkg-config
- pygobject
Expand Down
5 changes: 5 additions & 0 deletions galleries/examples/units/basic_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ def get_unit(self):


class BasicUnit:
# numpy scalars convert eager and np.float64(2) * BasicUnit('cm')
# would thus return a numpy scalar. To avoid this, we increase the
# priority of the BasicUnit.
__array_priority__ = np.float64(0).__array_priority__ + 1

def __init__(self, name, fullname=None):
self.name = name
if fullname is None:
Expand Down
Loading