Skip to content
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
Backport PR #29616: FIX: Fix unit example so that we can unpin numpy<2.1
  • Loading branch information
story645 authored and QuLogic committed Feb 14, 2025
commit e1dbace478f869d51fa5a09afb873c06bf288ecf
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>=8
- 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