Skip to content

Commit

Permalink
Merge pull request #255 from neutrinoceros/dep/numpy2_compat
Browse files Browse the repository at this point in the history
DEP: unpin numpy (declare numpy 2.0 compatibility)
  • Loading branch information
cphyc authored Sep 2, 2024
2 parents ac53ae2 + cd5d6d6 commit fabad64
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
rev: v0.5.0
hooks:
- id: ruff
args: [--fix]
args: [--fix, --show-fixes]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
requires = [
"setuptools>=61.2",
"Cython>=3.0",
"numpy>=1.25, <2.0",
"numpy>=2.0.0",
]

[project]
Expand Down Expand Up @@ -39,8 +39,7 @@ requires-python = ">=3.9"
dependencies = [
"h5py>=3.1.0",
"yt>=4.0.1",
# upper cap should be lifted when build-time requirement is bumped to >=2.0, see
"numpy>=1.19.3, <2.0",
"numpy>=1.19.3, <3",
"packaging>=20.9",
]

Expand Down Expand Up @@ -80,7 +79,11 @@ exclude = '''

[tool.ruff.lint]
exclude = ["*__init__.py", "*api.py"]
ignore = ["E501"]
ignore = [
"E501",
"NPY002", # numpy-legacy-random (not actually deprecated, and not auto-fixable)
]

select = [
"E",
"F",
Expand All @@ -91,6 +94,7 @@ select = [
"YTT", # flake8-2020
"I", # isort
"UP", # pyupgrade
"NPY", # NumPy-specific rules
]

[tool.ruff.lint.isort]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def particle_mask(self):
self._ds_sort = sp_pid.argsort()
sp_pid = sp_pid[self._ds_sort]
# This matches them up.
self._particle_mask = np.in1d(sp_pid, pid)
self._particle_mask = np.isin(sp_pid, pid)
return self._particle_mask

def center_of_mass(self):
Expand Down

0 comments on commit fabad64

Please sign in to comment.