deps: update numpy requirement from <2.0.0,>=1.26.0 to >=1.26.0,<3.0.0#49
Conversation
|
🎉 Thanks for your first pull request to AI Memory Module! A maintainer will review your PR soon. Here's what happens next:
Quick reminders:
Thanks for contributing! 🙏 |
|
@claude Review the Dependabot PRs on the ai-memory repository for breaking changes and compatibility issues. |
🤖 AI Analysis (Ollama kimi-k2.5:cloud)NumPy 2.x Upgrade ReviewExecutive SummaryRisk Level: 🔴 High This PR bumps the NumPy upper bound from 🔐 Security Analysis✅ Fixes Included (v2.2.6)
|
| Area | Change | Impact on topic drift computation |
|---|---|---|
| Copy Semantics | np.array(x, copy=False) now raises if copy needed |
May affect vector preprocessing pipelines |
| Scalar Representation | np.float64(1.0) prints as np.float64(1.0) not 1.0 |
Could break serialization/logging |
| Windows int64 | Default integer is now 64-bit on Windows | Potential memory doubling on Windows builds |
| Removed Functions | np.float_, np.int_ aliases removed |
Will raise AttributeError if used |
| Stricter Casting | np.can_cast behavior changed |
May affect type promotion in drift calculations |
Threading & Concurrency Risks
The stringdtype singleton fix suggests your codebase may use string arrays for token/topic handling. Edge case: Concurrent access to string-based topic vectors could segfault in NumPy 2.2.5 and earlier.
🔍 Code-Specific Review
Vector Operations (Topic Drift)
The comment indicates NumPy is used for "vector operations (topic drift computation)":
Potential Issues:
- Copy kwargs: If using
np.array(vector, copy=False)for zero-copy optimizations, NumPy 2.0 changed this behavior to potentially raise errors - Strided arrays: Changes to stride handling in 2.0 may affect memory views used in drift calculations
- Random number generation: If using
np.randomfor sampling in drift detection,GeneratorAPI changes in 2.0 may affect reproducibility
Dependency Chain Risks
Check compatibility with:
tiktoken: Verify it supports NumPy 2.x (token embeddings often use NumPy arrays)tree-sitter-*: Native extensions may be compiled against NumPy 1.x ABIdetect-secrets: Usually pure Python, but verify
✅ Pre-Merge Checklist
1. ABI Compatibility Test
# Test with strict NumPy 2.0 first (worst case)
pip install numpy==2.0.0
python -c "import numpy; import your_module; # test topic drift"2. Vector Operation Validation
# Test specific patterns that changed in 2.0
import numpy as np
# Test 1: Copy semantics
x = np.array([1.0, 2.0, 3.0])
y = np.array(x, copy=False) # Changed behavior in 2.0
# Test 2: String operations (security fix validation)
from numpy import strings
arr = np.array(["topic", "drift", "test"])
strings.find(arr, "p") # Test buffer overflow fix
# Test 3: Float scalars
assert str(np.float64(1.0)) == "np.float64(1.0)" # Breaking change3. Full Integration Test
- Run topic drift computation end-to-end
- Test with concurrent/threaded access (due to stringdtype fixes)
- Verify on Windows (int64 change affects memory)
- Check Python 3.10+ only (NumPy 2.2 drops 3.9)
4. Downstream Dependencies
Verify these packages have NumPy 2.x wheels:
tiktoken(checkpyproject.tomlfornumpypin)- Any C extensions in
tree-sitterbindings
🎯 Recommendations
Immediate Actions
- Pin to
>=2.0.0,<2.3.0initially instead of<3.0.0to avoid unknown 2.3+ breaking changes - Add CI matrix testing both NumPy 1.26 (minimum) and 2.2.6 (latest)
- Audit for deprecated aliases: Search codebase for
np.float_,np.int_,np.complex_
Code Changes Required
If any Cython/C extensions exist, they must be recompiled against NumPy 2.0 headers. Look for:
.pyxfilessetup.pywithnumpy.get_include()cimport numpystatements
Gradual Rollout Strategy
# Safer approach
numpy = [
{version = ">=1.26.0,<2.0.0", python = "<3.10"},
{version = ">=2.0.0,<2.3.0", python = ">=3.10"}
]Bottom Line: The security fixes (especially the heap buffer overflow) justify the upgrade, but NumPy 2.0 is not a drop-in replacement. Require full test suite passage with numpy==2.2.6 before merging.
Triggered by @Hidden-History
Updates the requirements on [numpy](https://github.com/numpy/numpy) to permit the latest version. - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst) - [Commits](numpy/numpy@v1.26.0...v2.2.6) --- updated-dependencies: - dependency-name: numpy dependency-version: 2.2.6 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
8895449 to
ac84090
Compare
Updates the requirements on numpy to permit the latest version.
Release notes
Sourced from numpy's releases.
... (truncated)
Commits
2b686f6Merge pull request #28980 from charris/prepare-2.2.6ed41828REL: Prepare for the NumPy 2.2.6 release [wheel build]83e4e7fMerge pull request #28966 from charris/backport-28958248f0cbTYP: add rejection-tests for complexndarrayfloordiv5bad9daTYP: reject complex scalar types inndarray.__ifloordiv__6c42775Merge pull request #28915 from charris/backport-288924277e7cMerge pull request #28916 from charris/backport-28898bd1c863BUG: Fix missing check for PyErr_Occurred() in _pyarray_correlate. (#28898)87d1d8aMAINT: Avoid dereferencing/strict aliasing warnings during complex casts in `...9e50659Merge pull request #28913 from charris/backport-28908Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)