Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update numpy dependency constraints and remove platform-specific… #156

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ requires-python = ">=3.10,<4"
dependencies = [
"h5py>=3.11.0,<4",
"joblib>=1.4.2,<2",
"numpy>=1.26.4,<2",
"numpy>=1.26.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

🛠️ Refactor suggestion

Consider maintaining an upper bound for numpy dependency

Based on the codebase analysis, the project heavily relies on numpy's array operations, particularly for:

  1. Medical image transformations and resampling
  2. Array manipulations (transpose, reshape, where)
  3. Mathematical operations (exp, log, floor)
  4. Type handling and array creation (zeros, array, asarray)

Given that:

  • The codebase extensively uses numpy's core functionality
  • numpy 2.0 introduces breaking changes in array creation, dtypes, and type handling
  • Medical image processing requires high reliability and reproducibility
  • Other dependencies maintain upper bounds (h5py<4, pandas<3)

Recommend maintaining the upper bound:

-  "numpy>=1.26.4",
+  "numpy>=1.26.4,<2",

Key reasons:

  • Extensive use of numpy array operations in critical image processing functions
  • Medical software requires strict version control for reliability
  • Consistency with other dependency constraints in the project
  • Protection against breaking changes in numpy 2.0
🔗 Analysis chain

Consider maintaining an upper bound for numpy dependency

The removal of the upper version bound for numpy (numpy>=1.26.4) deviates from the project's consistent dependency management pattern, where other dependencies maintain upper bounds (e.g., h5py>=3.11.0,<4, pandas>=2.2.2,<3). This change could introduce risks:

  1. numpy 2.0 introduces breaking changes that might affect the medical image processing pipeline
  2. Unbounded dependencies in medical software can compromise stability and reproducibility
  3. Inconsistent version constraints make dependency resolution less predictable

Consider maintaining the upper bound:

-  "numpy>=1.26.4",
+  "numpy>=1.26.4,<2",

Let's verify the potential impact of numpy 2.0:


Let's analyze how numpy is used in the codebase to better understand the potential impact of removing the upper bound constraint.


Let's analyze the actual numpy operations used in the codebase to better understand the potential impact of numpy 2.0 changes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for numpy API usage that might be affected by 2.0 changes
rg -l 'numpy' src/ | xargs rg -A 2 'np\.(matrix|bool_|float_|int_|unicode_|string_|deprecate|dtype|typeDict)'

Length of output: 109


Script:

#!/bin/bash
# Let's try a broader search for numpy usage patterns
rg -l 'numpy' src/

# Then search for specific numpy imports and usage
rg 'import numpy|from numpy' src/

# Also check for potential numpy type annotations
rg ':(?: +)?np\.' src/

Length of output: 2234


Script:

#!/bin/bash
# Let's check for specific numpy API usage that might be affected by 2.0 changes
rg 'np\.' src/ -A 2 | grep -v "import"

# Also check for array operations that might be sensitive to numpy changes
rg 'np\.(array|asarray|zeros|ones|empty|full|arange|linspace|reshape|transpose|concatenate|stack|vstack|hstack|split|where|logical_|bitwise_|add|subtract|multiply|divide)' src/

Length of output: 27818

"matplotlib>=3.8.4,<4",
"pandas>=2.2.2,<3",
"pydicom>=2.4.4",
Expand Down
Loading