Skip to content

Fix NumPy 2.x compatibility: replace removed np.in1d with np.isin - #3054

Merged
jgostick merged 1 commit into
devfrom
numpy2-in1d-isin
Jul 21, 2026
Merged

Fix NumPy 2.x compatibility: replace removed np.in1d with np.isin#3054
jgostick merged 1 commit into
devfrom
numpy2-in1d-isin

Conversation

@jgostick

Copy link
Copy Markdown
Member

I am trying to get the CI to run on the PR. I cannot seem to make it happen on the PR from @gaoflow's PR, so I created a new branch and pushed it.

np.in1d was deprecated in NumPy 1.25 and removed from the main namespace
in NumPy 2.x, but pyproject.toml pins numpy>=2. Several core functions
therefore raise 'AttributeError: module numpy has no attribute in1d' on a
supported NumPy version, breaking e.g. find_nearby_pores, site/bond
percolation cluster filtering and neighbor queries.

Replace the remaining np.in1d call sites with np.isin, the documented
drop-in replacement (identical semantics for 1-D inputs, including the
invert= keyword). The codebase already uses np.isin elsewhere, so this
also unifies the idiom.
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.8%. Comparing base (0f3a841) to head (366c434).

Additional details and impacted files
@@          Coverage Diff          @@
##             dev   #3054   +/-   ##
=====================================
  Coverage   87.8%   87.8%           
=====================================
  Files        151     151           
  Lines       8882    8882           
=====================================
  Hits        7804    7804           
  Misses      1078    1078           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jgostick
jgostick merged commit 4a96c64 into dev Jul 21, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants