Skip to content

Support NumPy 2.5.0#2308

Merged
kounelisagis merged 4 commits into
mainfrom
agis/numpy-2.5
Jul 1, 2026
Merged

Support NumPy 2.5.0#2308
kounelisagis merged 4 commits into
mainfrom
agis/numpy-2.5

Conversation

@kounelisagis

@kounelisagis kounelisagis commented Jun 28, 2026

Copy link
Copy Markdown
Member

NumPy 2.5 deprecated setting .dtype and .shape on an array in place, so those spots now use view() / 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

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread tiledb/core.cc Outdated
Comment thread tiledb/npbuffer.cc Outdated
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.
@kounelisagis kounelisagis requested review from ihnorton and ypatia June 30, 2026 08:50
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.
@kounelisagis kounelisagis merged commit b6f99b9 into main Jul 1, 2026
27 checks passed
@kounelisagis kounelisagis deleted the agis/numpy-2.5 branch July 1, 2026 08:34
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.

Support numpy 2.5.0

3 participants