Skip to content

Commit

Permalink
Test against numpy>=2.0.0rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed May 2, 2024
1 parent 6591175 commit 7f1527d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.python.version != '3.8'
- name: Store wheels
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v4
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
18 changes: 9 additions & 9 deletions test/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 7f1527d

Please sign in to comment.