diff --git a/.github/workflows/artifact.yaml b/.github/workflows/artifact.yaml index 47710583..3a839ed1 100644 --- a/.github/workflows/artifact.yaml +++ b/.github/workflows/artifact.yaml @@ -115,6 +115,11 @@ jobs: - run: ./integration/run http - run: ./integration/run init + - run: | + uv pip install -U --pre "numpy>=2.0.0rc1" + pytest -s test/test_numpy.py + if: matrix.pyton.version != '3.8' + - name: Store wheels if: "startsWith(github.ref, 'refs/tags/')" uses: actions/upload-artifact@v4 diff --git a/README.md b/README.md index 4b272676..b17fc7c6 100644 --- a/README.md +++ b/README.md @@ -819,6 +819,8 @@ orjson natively serializes `numpy.ndarray` and individual `numpy.uintp`, `numpy.intp`, `numpy.datetime64`, and `numpy.bool` instances. +orjson is compatible with both numpy v1 and v2. + orjson is faster than all compared libraries at serializing numpy instances. Serializing numpy data requires specifying `option=orjson.OPT_SERIALIZE_NUMPY`. diff --git a/test/test_numpy.py b/test/test_numpy.py index 28eacd5a..dd506a21 100644 --- a/test/test_numpy.py +++ b/test/test_numpy.py @@ -155,10 +155,10 @@ def test_numpy_array_f16_edge(self): numpy.array( [ numpy.inf, - numpy.NINF, + -numpy.inf, numpy.nan, - numpy.NZERO, - numpy.PZERO, + -0.0, + 0.0, numpy.pi, ], numpy.float16, @@ -174,10 +174,10 @@ def test_numpy_array_f32_edge(self): numpy.array( [ numpy.inf, - numpy.NINF, + -numpy.inf, numpy.nan, - numpy.NZERO, - numpy.PZERO, + -0.0, + 0.0, numpy.pi, ], numpy.float32, @@ -193,10 +193,10 @@ def test_numpy_array_f64_edge(self): numpy.array( [ numpy.inf, - numpy.NINF, + -numpy.inf, numpy.nan, - numpy.NZERO, - numpy.PZERO, + -0.0, + 0.0, numpy.pi, ], numpy.float64,