Back to Numpy

Current build and release info

doc/HOWTO_RELEASE.rst

2.5.0.dev08.1 KB
Original Source

These instructions give an overview of what is necessary to build binary releases for NumPy.

Current build and release info

Useful info can be found in building-from-source in the docs as well as in these three files:

  • HOWTO_RELEASE.rst <https://github.com/numpy/numpy/blob/main/doc/HOWTO_RELEASE.rst>_
  • RELEASE_WALKTHROUGH.rst <https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst>_
  • BRANCH_WALKTHROUGH.rst <https://github.com/numpy/numpy/blob/main/doc/BRANCH_WALKTHROUGH.rst>_

Supported platforms and versions

:ref:NEP 29 <NEP29> outlines which Python versions are supported at a minimum. We usually decide to keep support for a given Python version slightly longer than that minimum, to avoid giving other projects issues - this is at the discretion of the release manager.

  • macOS

    We aim to support the same set of macOS versions as are supported by Python.org and cibuildwheel_ for any given Python version. We build binary wheels for macOS that are compatible with common Python installation methods, e.g., from python.org, python-build-standalone (the ones uv installs), system Python, conda-forge, Homebrew and MacPorts.

  • Windows

    We build 32- and 64-bit wheels on Windows. Windows 7, 8 and 10 are supported. We build NumPy using the most convenient compilers, which are (as of Aug 2025) MSVC for x86/x86-64 and Clang-cl for arm64, cibuildwheel_ and GitHub Actions.

.. _cibuildwheel: https://cibuildwheel.readthedocs.io/en/stable/

  • Linux

    We build and ship manylinux and musllinux wheels for x86-64 and aarch64 platforms on PyPI. Wheels for 32-bit platforms are not currently provided. We aim to support the lowest non-EOL versions, and upgrade roughly in sync with cibuildwheel_. See pypa/manylinux <https://github.com/pypa/manylinux>__ and this distro compatibility table <https://github.com/mayeut/pep600_compliance?tab=readme-ov-file#distro-compatibility>__ for more details.

  • BSD / Solaris / AIX

    No binary wheels are provided on PyPI, however we expect building from source on these platforms to work fine.

Toolchains

For building wheels, we use the following toolchains:

  • Linux: we use the default compilers in the manylinux/musllinux Docker images, which is usually a relatively recent GCC version.
  • macOS: we use the Apple Clang compilers and XCode version installed on the GitHub Actions runner image.
  • Windows: for x86 and x86-64 we use the default MSVC and Visual Studio toolchain installed on the relevant GitHub actions runner image. Note that in the past it has sometimes been necessary to use an older toolchain to avoid causing problems through the static libnpymath library for SciPy - please inspect the numpy/numpy-release <https://github.com/numpy/numpy-release>__ code and CI logs in case the exact version numbers need to be determined.

For building from source, minimum compiler versions are tracked in the top-level meson.build file.

OpenBLAS

Most wheels link to a version of OpenBLAS_ supplied via the openblas-libs_ repo. The shared object (or DLL) is shipped within the wheel, renamed to prevent name collisions with other OpenBLAS shared objects that may exist in the filesystem.

.. _OpenBLAS: https://github.com/OpenMathLib/OpenBLAS .. _openblas-libs: https://github.com/MacPython/openblas-libs

Building docs

We are no longer building pdf files. The requirements for building the html docs are no different than for regular development. See the README of the numpy/doc <https://github.com/numpy/doc>__ repository and the step by step instructions in doc/RELEASE_WALKTHROUGH.rst for more details.

Uploading to PyPI

Creating a release on PyPI and uploading wheels and sdist is automated in CI and uses PyPI's trusted publishing <https://docs.pypi.org/trusted-publishers/>. See the README in the numpy/numpy-release <https://github.com/numpy/numpy-release> repository and the step by step instructions in doc/RELEASE_WALKTHROUGH.rst for more details.

Generating author/PR lists

You will need a personal access token <https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/>_ so that scripts can access the GitHub NumPy repository. With that token, the author/PR changelog content can be generated by running spin changelog. It may require a few extra packages, like gitpython and pygithub.

What is released

On PyPI we release wheels for a number of platforms (as discussed higher up), and an sdist.

On GitHub Releases we release the same sdist (because the source archives which are autogenerated by GitHub itself aren't complete), as well as the release notes and changelog.

Release process

Agree on a release schedule

A typical release schedule for a feature release is two release candidates and a final release. It's best to discuss the timing on the mailing list first, in order for people to get their commits in on time. After a date is set, create a new maintenance/x.y.z branch, add new empty release notes for the next version in the main branch and update the Milestones on the issue tracker.

Check deprecations

Before :ref:the release branch is made <branching>, it should be checked that all deprecated code that should be removed is actually removed, and all new deprecations say in the docstring or deprecation warning what version the code will be removed.

Check the C API version number

The C API version needs to be tracked in three places

  • numpy/_core/meson.build
  • numpy/_core/code_generators/cversions.txt
  • numpy/_core/include/numpy/numpyconfig.h

There are three steps to the process.

  1. If the API has changed, increment the C_API_VERSION in numpy/core/meson.build. The API is unchanged only if any code compiled against the current API will be backward compatible with the last released NumPy version. Any changes to C structures or additions to the public interface will make the new API not backward compatible.

  2. If the C_API_VERSION in the first step has changed, or if the hash of the API has changed, the cversions.txt file needs to be updated. To check the hash, run the script numpy/_core/cversions.py and note the API hash that is printed. If that hash does not match the last hash in numpy/_core/code_generators/cversions.txt the hash has changed. Using both the appropriate C_API_VERSION and hash, add a new entry to cversions.txt. If the API version was not changed, but the hash differs, you will need to comment out the previous entry for that API version. For instance, in NumPy 1.9 annotations were added, which changed the hash, but the API was the same as in 1.8. The hash serves as a check for API changes, but it is not definitive.

    If steps 1 and 2 are done correctly, compiling the release should not give a warning "API mismatch detect at the beginning of the build".

  3. The numpy/_core/include/numpy/numpyconfig.h will need a new NPY_X_Y_API_VERSION macro, where X and Y are the major and minor version numbers of the release. The value given to that macro only needs to be increased from the previous version if some of the functions or macros in the include files were deprecated.

The C ABI version number in numpy/_core/meson.build should only be updated for a major release.

Check the release notes

Use towncrier_ to build the release note and commit the changes. This will remove all the fragments from doc/release/upcoming_changes and add doc/release/<version>-note.rst.::

towncrier build --version "<version>"
git commit -m"Create release note"

Check that the release notes are up-to-date.

Update the release notes with a Highlights section. Mention some of the following:

  • major new features
  • deprecated and removed features
  • supported Python versions
  • for SciPy, supported NumPy version(s)
  • outlook for the near future

.. _towncrier: https://pypi.org/project/towncrier/