Skip to content

Conversation

@copybara-service
Copy link

PR #35668: Bump numpy from 2.3.5 to 2.4.0

Imported from GitHub PR #35668

Bumps numpy from 2.3.5 to 2.4.0.

Release notes

Sourced from numpy's releases.

2.4.0 (Dec 20, 2025)

NumPy 2.4.0 Release Notes

The NumPy 2.4.0 release continues the work to improve free threaded Python support, user dtypes implementation, and annotations. There are many expired deprecations and bug fixes as well.

This release supports Python versions 3.11-3.14

Highlights

Apart from annotations and same_value kwarg, the 2.4 highlights are mostly of interest to downstream developers. They should help in implementing new user dtypes.

  • Many annotation improvements. In particular, runtime signature introspection.
  • New casting kwarg 'same_value' for casting by value.
  • New PyUFunc_AddLoopsFromSpec function that can be used to add user sort loops using the ArrayMethod API.
  • New __numpy_dtype__ protocol.

Deprecations

Setting the strides attribute is deprecated

Setting the strides attribute is now deprecated since mutating an array is unsafe if an array is shared, especially by multiple threads. As an alternative, you can create a new view (no copy) via:

  • np.lib.stride_tricks.strided_window_view if applicable,
  • np.lib.stride_tricks.as_strided for the general case,
  • or the np.ndarray constructor (buffer is the original array) for a light-weight version.

(gh-28925)

Positional out argument to np.maximum, np.minimum is deprecated

Passing the output array out positionally to numpy.maximum and numpy.minimum is deprecated. For example, np.maximum(a, b, c) will emit a deprecation warning, since c is treated as the output buffer rather than a third input.

Always pass the output with the keyword form, e.g. np.maximum(a, b, out=c). This makes intent clear and simplifies type annotations.

(gh-29052)

align= must be passed as boolean to np.dtype()

... (truncated)

Changelog

Sourced from numpy's changelog.

Update 2.4.0 milestones

Look at the issues/prs with 2.4.0 milestones and either push them off to a later version, or maybe remove the milestone. You may need to add a milestone.

Check the numpy-release repo

The things to check are the cibuildwheel version in .github/workflows/wheels.yml and the openblas versions in openblas_requirements.txt.

Make a release PR

Four documents usually need to be updated or created for the release PR:

  • The changelog
  • The release notes
  • The .mailmap file
  • The pyproject.toml file

These changes should be made in an ordinary PR against the maintenance branch. Other small, miscellaneous fixes may be part of this PR. The commit message might be something like::

REL: Prepare for the NumPy 2.4.0 release
  • Create 2.4.0-changelog.rst.
  • Update 2.4.0-notes.rst.
  • Update .mailmap.
  • Update pyproject.toml

Set the release version

Check the pyproject.toml file and set the release version and update the classifier if needed::

$ gvim pyproject.toml

Check the doc/source/release.rst file

make sure that the release notes have an entry in the release.rst file::

... (truncated)

Commits

Dependabot compatibility score

Dependabot 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 rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will 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 version will 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 dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Copybara import of the project:

--
c60ba63 by dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>:

Bump numpy from 2.3.5 to 2.4.0

Bumps numpy from 2.3.5 to 2.4.0.


updated-dependencies:

  • dependency-name: numpy
    dependency-version: 2.4.0
    dependency-type: direct:production
    update-type: version-update:semver-minor
    ...

Signed-off-by: dependabot[bot] support@github.com

Merging this change closes #35668

FUTURE_COPYBARA_INTEGRATE_REVIEW=#35668 from openxla:dependabot/pip/numpy-2.4.0 c60ba63

Imported from GitHub PR #35668

Bumps [numpy](https://github.com/numpy/numpy) from 2.3.5 to 2.4.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/numpy/numpy/releases">numpy's releases</a>.</em></p>
<blockquote>
<h2>2.4.0 (Dec 20, 2025)</h2>
<h1>NumPy 2.4.0 Release Notes</h1>
<p>The NumPy 2.4.0 release continues the work to improve free threaded Python
support, user dtypes implementation, and annotations. There are many expired
deprecations and bug fixes as well.</p>
<p>This release supports Python versions 3.11-3.14</p>
<h2>Highlights</h2>
<p>Apart from annotations and <code>same_value</code> kwarg, the 2.4 highlights are mostly
of interest to downstream developers. They should help in implementing new user
dtypes.</p>
<ul>
<li>Many annotation improvements. In particular, runtime signature introspection.</li>
<li>New <code>casting</code> kwarg <code>'same_value'</code> for casting by value.</li>
<li>New <code>PyUFunc_AddLoopsFromSpec</code> function that can be used to add user sort
loops using the <code>ArrayMethod</code> API.</li>
<li>New <code>__numpy_dtype__</code> protocol.</li>
</ul>
<h2>Deprecations</h2>
<h3>Setting the <code>strides</code> attribute is deprecated</h3>
<p>Setting the strides attribute is now deprecated since mutating
an array is unsafe if an array is shared, especially by multiple
threads. As an alternative, you can create a new view (no copy) via:</p>
<ul>
<li><code>np.lib.stride_tricks.strided_window_view</code> if applicable,</li>
<li><code>np.lib.stride_tricks.as_strided</code> for the general case,</li>
<li>or the <code>np.ndarray</code> constructor (<code>buffer</code> is the original array) for a
light-weight version.</li>
</ul>
<p>(<a href="https://redirect.github.com/numpy/numpy/pull/28925">gh-28925</a>)</p>
<h3>Positional <code>out</code> argument to <code>np.maximum</code>, <code>np.minimum</code> is deprecated</h3>
<p>Passing the output array <code>out</code> positionally to <code>numpy.maximum</code> and
<code>numpy.minimum</code> is deprecated. For example, <code>np.maximum(a, b, c)</code> will emit
a deprecation warning, since <code>c</code> is treated as the output buffer rather than
a third input.</p>
<p>Always pass the output with the keyword form, e.g. <code>np.maximum(a, b, out=c)</code>.
This makes intent clear and simplifies type annotations.</p>
<p>(<a href="https://redirect.github.com/numpy/numpy/pull/29052">gh-29052</a>)</p>
<h3><code>align=</code> must be passed as boolean to <code>np.dtype()</code></h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst">numpy's changelog</a>.</em></p>
<blockquote>
<h2>Update 2.4.0 milestones</h2>
<p>Look at the issues/prs with 2.4.0 milestones and either push them off to a
later version, or maybe remove the milestone. You may need to add a milestone.</p>
<h2>Check the numpy-release repo</h2>
<p>The things to check are the <code>cibuildwheel</code> version in
<code>.github/workflows/wheels.yml</code> and the <code>openblas</code> versions in
<code>openblas_requirements.txt</code>.</p>
<h1>Make a release PR</h1>
<p>Four documents usually need to be updated or created for the release PR:</p>
<ul>
<li>The changelog</li>
<li>The release notes</li>
<li>The <code>.mailmap</code> file</li>
<li>The <code>pyproject.toml</code> file</li>
</ul>
<p>These changes should be made in an ordinary PR against the maintenance branch.
Other small, miscellaneous fixes may be part of this PR. The commit message
might be something like::</p>
<pre><code>REL: Prepare for the NumPy 2.4.0 release
<ul>
<li>Create 2.4.0-changelog.rst.</li>
<li>Update 2.4.0-notes.rst.</li>
<li>Update .mailmap.</li>
<li>Update pyproject.toml<br />
</code></pre></li>
</ul>
<h2>Set the release version</h2>
<p>Check the <code>pyproject.toml</code> file and set the release version and update the
classifier if needed::</p>
<pre><code>$ gvim pyproject.toml
</code></pre>
<h2>Check the <code>doc/source/release.rst</code> file</h2>
<p>make sure that the release notes have an entry in the <code>release.rst</code> file::</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/numpy/numpy/commit/c5ab79c14c98bfda1e60770ffa23a6130f8267b7"><code>c5ab79c</code></a> Merge pull request <a href="https://redirect.github.com/numpy/numpy/issues/30487">#30487</a> from charris/prepare-2.4.0.2</li>
<li><a href="https://github.com/numpy/numpy/commit/05e379a9c925dbeca59851b881c64ba098c5abab"><code>05e379a</code></a> REL: Prepare for the NumPy 2.4.0 release (2)</li>
<li><a href="https://github.com/numpy/numpy/commit/485f1c40703f1c43be708be4c7b7a21b10d90337"><code>485f1c4</code></a> REL: Prepare for the NumPy 2.4.0 release (1) (<a href="https://redirect.github.com/numpy/numpy/issues/30486">#30486</a>)</li>
<li><a href="https://github.com/numpy/numpy/commit/c683481c9bace3c6a3ba487f50b34539832377a8"><code>c683481</code></a> REL: Prepare for the NumPy 2.4.0 release (<a href="https://redirect.github.com/numpy/numpy/issues/30439">#30439</a>)</li>
<li><a href="https://github.com/numpy/numpy/commit/11d9ed27e07637aa92b8d43bf2ad380a2b8c5c01"><code>11d9ed2</code></a> Merge pull request <a href="https://redirect.github.com/numpy/numpy/issues/30459">#30459</a> from charris/backport-30456</li>
<li><a href="https://github.com/numpy/numpy/commit/2a17ddb25580f20f27c76327733449434c302032"><code>2a17ddb</code></a> TYP: restore <code>generic.__hash__</code> (<a href="https://redirect.github.com/numpy/numpy/issues/30456">#30456</a>)</li>
<li><a href="https://github.com/numpy/numpy/commit/d04a4293bf8c8345f072891433ddb8c483785a6b"><code>d04a429</code></a> Merge pull request <a href="https://redirect.github.com/numpy/numpy/issues/30432">#30432</a> from charris/backport-30426</li>
<li><a href="https://github.com/numpy/numpy/commit/f94a148bc07fd167275f167995edce57b4f0b8c5"><code>f94a148</code></a> fix more data races in mtrand.pyx (<a href="https://redirect.github.com/numpy/numpy/issues/30426">#30426</a>)</li>
<li><a href="https://github.com/numpy/numpy/commit/06a9d4219291f5a15eed54de9314f72b74c41aed"><code>06a9d42</code></a> Merge pull request <a href="https://redirect.github.com/numpy/numpy/issues/30420">#30420</a> from charris/backport-30418</li>
<li><a href="https://github.com/numpy/numpy/commit/30819cd952a4a92852d619b5dd720c63fbcab6bd"><code>30819cd</code></a> Merge pull request <a href="https://redirect.github.com/numpy/numpy/issues/30419">#30419</a> from charris/backport-30373</li>
<li>Additional commits viewable in <a href="https://github.com/numpy/numpy/compare/v2.3.5...v2.4.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=numpy&package-manager=pip&previous-version=2.3.5&new-version=2.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot 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-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will 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 version` will 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 dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>
Copybara import of the project:

--
c60ba63 by dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>:

Bump numpy from 2.3.5 to 2.4.0

Bumps [numpy](https://github.com/numpy/numpy) from 2.3.5 to 2.4.0.
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](numpy/numpy@v2.3.5...v2.4.0)

---
updated-dependencies:
- dependency-name: numpy
  dependency-version: 2.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Merging this change closes #35668

FUTURE_COPYBARA_INTEGRATE_REVIEW=#35668 from openxla:dependabot/pip/numpy-2.4.0 c60ba63
PiperOrigin-RevId: 850730763
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.

0 participants