Skip to content

Commit

Permalink
BLD: Build against numpy >= 2.0.0rc1
Browse files Browse the repository at this point in the history
This unpins numpy<2 and builds the SWIG C library against numpy >=
2.0.0rc1. Versions of numpy major 2 are backward compatible with numpy
1. Hence we should not see issues in environment where numpy<2 may be
maintained for years to come, i.e. RMS environments.

The numpy SWIG bindings committed in this repository are not out-of-date
in a way that would break compatibility. The last update to them in
numpy's repository was two years ago from the time of this commit.
  • Loading branch information
mferrera committed Aug 23, 2024
1 parent 934e94c commit 55283a5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
mypy:
strategy:
matrix:
python-version: ["3.8", "3.11"]
python-version: ["3.9", "3.12"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
fail-fast: false
matrix:
python:
- ['3.8', cp38]
- ['3.9', cp39]
- ['3.10', cp310]
- ['3.11', cp311]
Expand All @@ -26,8 +25,6 @@ jobs:
- [macos-13, macosx_x86_64] # macos-13 is the last x86-64 runner
- [macos-latest, macosx_arm64] # macos-latest is always arm64 going forward
exclude:
- os_arch: [macos-latest, macosx_arm64]
python: ['3.8', cp38]
- os_arch: [macos-latest, macosx_arm64]
python: ['3.9', cp39]
env:
Expand Down
16 changes: 1 addition & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest]
include:
- os: macos-latest
python-version: "3.10"
- os: macos-latest
python-version: 3.12
- os: windows-latest
python-version: 3.8
- os: windows-latest
python-version: 3.12

Expand Down Expand Up @@ -82,18 +80,6 @@ jobs:
fail-fast: false
matrix:
config:
- {
name: "RMS 12.1.4, 13.0.3, 13.1.0, 14.1.1",
os: ubuntu-20.04,
python: 3.8.6,
pip: 23.2.1,
wheel: 0.37.1,
setuptools: 63.4.3,
matplotlib: 3.3.2,
numpy: 1.19.2,
pandas: 1.1.3,
scipy: 1.5.3,
}
- {
name: "RMS 14.2",
os: ubuntu-latest,
Expand Down
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ requires = [
"pybind11",
"scikit-build-core[pyproject]>=0.10",
"swig",
"numpy==1.19.2; python_version == '3.8'",
"numpy==1.19.5; python_version == '3.9'",
"numpy==1.21.6; python_version == '3.10'",
"numpy==1.23.5; python_version == '3.11'",
"numpy==1.26.2; python_version == '3.12'",
"numpy>=2.0.0rc1",
]
build-backend = "scikit_build_core.build"

Expand Down Expand Up @@ -53,7 +49,7 @@ dependencies = [
"hdf5plugin>=2.3",
"joblib",
"matplotlib>=3.3",
"numpy<2",
"numpy",
"pandas>=1.1",
"resfo>=4.0.0",
"roffio>=0.0.2",
Expand Down
7 changes: 6 additions & 1 deletion tests/test_grid3d/test_grid_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ def test_assign():
# this shall now broadcast the value 33 to all activecells
x.isdiscrete = True
x.values = 33
assert x.dtype == np.int32

numpy_version = tuple(map(int, np.__version__.split(".")))
if numpy_version >= (2, 0, 0):
assert x.dtype == np.int64
else:
assert x.dtype == np.int32

x.isdiscrete = False
x.values = 44.0221
Expand Down

0 comments on commit 55283a5

Please sign in to comment.