chore: bump jaxtyping to 0.3.4 and drop numpy workaround#67
Conversation
jaxtyping 0.3.4 no longer crashes when numpy is absent, so the explicit numpy pin added for issue #360 is no longer needed. Co-authored-by: Cursor <cursoragent@cursor.com>
Code Review by Qodo
1.
|
Update uv.lock after jaxtyping bump. Co-authored-by: Cursor <cursoragent@cursor.com>
| dependencies = [ | ||
| "array-api-compat>=1.11.0", | ||
| "einops>=0.8.0", | ||
| "jaxtyping>=0.2.36", | ||
| # TODO: remove numpy dependency once jaxtyping no longer implicitly depends on numpy | ||
| # https://github.com/patrick-kidger/jaxtyping/issues/360 | ||
| "numpy>=1.25.0", | ||
| "jaxtyping>=0.3.4", | ||
| ] |
There was a problem hiding this comment.
2. Vis extra missing numpy 🐞 Bug ≡ Correctness
After dropping core numpy, mach._vis fails to import because it unconditionally imports numpy, but the vis optional dependency set does not include numpy (so pip install mach-beamform[vis] is insufficient).
Agent Prompt
### Issue description
`src/mach/_vis.py` imports `numpy` at module import time, but after removing `numpy` from core dependencies, installing `mach-beamform[vis]` does not install `numpy`. This causes `import mach._vis` (and anything that imports it) to fail with `ModuleNotFoundError: numpy`.
### Issue Context
`mach._vis` already provides a helpful install hint for missing `matplotlib`, but missing `numpy` will now be the failure mode in a base environment without numpy.
### Fix Focus Areas
- pyproject.toml[40-49]
- src/mach/_vis.py[5-12]
- pyproject.toml[31-35]
### What to change
- Add `numpy>=1.25.0` (or an appropriate minimum) to `[project.optional-dependencies].vis`.
- (Optional hardening) Wrap the `import numpy as np` in a `try/except ImportError` and raise a targeted message similar to the existing matplotlib guidance.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit 00621ee |
mach._vis imports numpy at module load time; after removing numpy from core deps, mach-beamform[vis] must install it explicitly. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
jaxtypingfrom>=0.2.36to>=0.3.4numpy>=1.25.0core dependency that was only needed as a workaround for jaxtyping#360jaxtyping v0.3.4 includes the fix from patrick-kidger/jaxtyping#361, so
machcan import without numpy installed in the base environment. Numpy remains available via optional extras (e.g.uff).Test plan
uvx --with mach --python 3.12 python -c "import mach"works without numpy in the base installMade with Cursor