Support NumPy 2.5.0#2308
Merged
Merged
Conversation
Replace the now-deprecated `ndarray.dtype`/`shape` attribute assignments with `view()`/`reshape()`, compute datetime dimension bounds in int64 to avoid the new overflow errors, and add 2.5.0 to the nightly matrix.
There was a problem hiding this comment.
Pull request overview
This PR updates TileDB-Py for compatibility with NumPy 2.5.0 by removing reliance on deprecated in-place ndarray.dtype/ndarray.shape assignments and by adjusting datetime64 arithmetic to avoid overflow behavior changes.
Changes:
- Replaced in-place dtype/shape mutations with
view()/reshape()across array read/query result paths. - Updated datetime64 range/tile calculations and tests to avoid int64 overflow and NumPy 2.5 datetime arithmetic changes.
- Updated the daily NumPy CI matrix to include NumPy 2.5.0 for newer Python versions.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tiledb/tests/test_subarray.py | Updates tests to use view() instead of assigning dtype. |
| tiledb/tests/test_libtiledb.py | Adjusts datetime slice math to use timedeltas (avoids overflow/behavior changes). |
| tiledb/tests/test_core.py | Updates query-result dtype handling to use view(). |
| tiledb/sparse_array.py | Switches result buffer dtype reinterpretation to view() for NumPy 2.5 compatibility. |
| tiledb/npbuffer.cc | Replaces deprecated shape mutation with reshape(-1) + iterator fallback logic. |
| tiledb/multirange_indexing.py | Uses reshape() instead of setting shape on returned arrays. |
| tiledb/dense_array.py | Uses view()/reshape() (and np.require) instead of in-place dtype/shape mutation. |
| tiledb/dataframe_.py | Computes datetime dimension bounds/ranges in Python ints to avoid int64 overflow. |
| tiledb/core.cc | Avoids setting dtype attribute on a uint8 array by constructing the typed array directly. |
| tiledb/array.py | Uses view() for buffer dtype interpretation in set_query. |
| .github/workflows/daily-test-build-numpy.yml | Updates CI matrix to test NumPy 2.5.0 on py312+ combinations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Raise instead of silently truncating when a cell's byte length is not a whole number of dtype elements, and reword the npbuffer comment to match what the copy branch actually does.
3.11 dropped out of numpy 2.5, so its newest supported numpy is 2.4.6, and 3.14 was missing its oldest supported numpy (2.3.x).
view() returns a new array, so the temporary `arr = results[...][0]` line that the old in-place `arr.dtype =` needed is no longer necessary.
ypatia
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NumPy 2.5 deprecated setting
.dtypeand.shapeon an array in place, so those spots now useview()/reshape()instead. It also made datetime64 arithmetic raise on int64 overflow instead of wrapping silently, so full-domain datetime dimension bounds are now computed on the underlying int64 values.Also refreshed the nightly matrix to cover the oldest and newest numpy each Python supports (including 2.5).
Tested the full suite on numpy 1.26, 2.3 and 2.5.
Closes #2307
cc @jdblischak