Skip to content

Commit

Permalink
Merge pull request #422 from WilliamJamieson/bugfix/numpy2.0
Browse files Browse the repository at this point in the history
Fixes for NumPy 2.0 compatiblity
  • Loading branch information
seperman authored Sep 26, 2023
2 parents 2f62074 + c9232d2 commit 4fe9f92
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ jobs:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
architecture: ["x64"]
include:
- python-version: 3.9
numpy-version: "2.0.dev"
- python-version: 3.10
numpy-version: "2.0.dev"
- python-version: 3.11
numpy-version: "2.0.dev"
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }} on ${{ matrix.architecture }}
Expand All @@ -37,6 +44,9 @@ jobs:
- name: Install dependencies
if: matrix.python-version != 3.7
run: pip install -r requirements-dev.txt
- name: Install Numpy Dev
if: ${{ matrix.numpy-version }}
run: pip install -I --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple "numpy>=0.0.dev0"
- name: Lint with flake8
if: matrix.python-version == 3.11
run: |
Expand Down
6 changes: 3 additions & 3 deletions deepdiff/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ class pydantic_base_model_type:
np_uintp = np.uintp
np_float32 = np.float32
np_float64 = np.float64
np_float_ = np.float_
np_float_ = np.double # np.float_ is an alias for np.double and is being removed by NumPy 2.0
np_floating = np.floating
np_complex64 = np.complex64
np_complex128 = np.complex128
np_complex_ = np.complex_
np_complex_ = np.cdouble # np.complex_ is an alias for np.cdouble and is being removed by NumPy 2.0
np_complexfloating = np.complexfloating

numpy_numbers = (
Expand Down Expand Up @@ -655,7 +655,7 @@ def diff_numpy_array(A, B):
By Divakar
https://stackoverflow.com/a/52417967/1497443
"""
return A[~np.in1d(A, B)]
return A[~np.isin(A, B)]


PYTHON_TYPE_TO_NUMPY_TYPE = {
Expand Down

0 comments on commit 4fe9f92

Please sign in to comment.