Releasing a version#
The following guides include detailed information on how to prepare a NumPy release.
How to prepare a release#
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:
Supported platforms and versions#
NEP 29 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 onesuvinstalls), 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.
Linux
We build and ship
manylinuxandmusllinuxwheels 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 and this distro compatibility table 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/musllinuxDocker 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
libnpymathlibrary for SciPy - please inspect the 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.
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 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.
See the README in the numpy/numpy-release
repository and the step by step instructions in doc/RELEASE_WALKTHROUGH.rst
for more details.
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 the release branch is made, 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.
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.
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”.
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
Step-by-step directions#
This is a walkthrough of the NumPy 2.4.0 release on Linux, which will be the first feature release using the numpy/numpy-release repository.
The commands can be copied into the command line, but be sure to replace 2.4.0 with the correct version. This should be read together with the general release guide.
Facility preparation#
Before beginning to make a release, use the requirements/*_requirements.txt files to
ensure that you have the needed software. Most software can be installed with
pip, but some will require apt-get, dnf, or whatever your system uses for
software. You will also need a GitHub personal access token (PAT) to push the
documentation. There are a few ways to streamline things:
Git can be set up to use a keyring to store your GitHub personal access token. Search online for the details.
You can use the
keyringapp to store the PyPI password for twine. See the online twine documentation for details.
Prior to release#
Add/drop Python versions#
When adding or dropping Python versions, multiple config and CI files need to
be edited in addition to changing the minimum version in pyproject.toml.
Make these changes in an ordinary PR against main and backport if necessary.
We currently release wheels for new Python versions after the first Python RC
once manylinux and cibuildwheel support that new Python version.
Backport pull requests#
Changes that have been marked for this release must be backported to the maintenance/2.4.x branch.
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
.mailmapfileThe
pyproject.tomlfile
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:
$ gvim doc/source/release.rst
Generate the changelog#
The changelog is generated using the changelog tool:
$ spin changelog $GITHUB v2.3.0..maintenance/2.4.x > doc/changelog/2.4.0-changelog.rst
where GITHUB contains your GitHub access token. The text will need to be
checked for non-standard contributor names. It is also a good idea to remove
any links that may be present in the PR titles as they don’t translate well to
Markdown, replace them with monospaced text. The non-standard contributor names
should be fixed by updating the .mailmap file, which is a lot of work. It
is best to make several trial runs before reaching this point and ping the
malefactors using a GitHub issue to get the needed information.
Finish the release notes#
If there are any release notes snippets in doc/release/upcoming_changes/,
run spin notes, which will incorporate the snippets into the
doc/source/release/notes-towncrier.rst file and delete the snippets:
$ spin notes
$ gvim doc/source/release/notes-towncrier.rst doc/source/release/2.4.0-notes.rst
Once the notes-towncrier contents has been incorporated into release note
the .. include:: notes-towncrier.rst directive can be removed. The notes
will always need some fixups, the introduction will need to be written, and
significant changes should be called out. For patch releases the changelog text
may also be appended, but not for the initial release as it is too long. Check
previous release notes to see how this is done.
Test the wheel builds#
After the release PR is merged, go to the numpy-release repository in your
browser and manually trigger the workflow on the maintenance/2.4.x branch
using the Run workflow button in actions. Make sure that the upload
target is none in the evironment dropdown. The wheels take about 1 hour
to build, but sometimes GitHub is very slow. If some wheel builds fail for
unrelated reasons, you can re-run them as normal in the GitHub Actions UI with
re-run failed. After the wheels are built review the results, checking that
the number of artifacts are correct, the wheel names are as expected, etc. If
everything looks good, proceed with the release.
Release walkthrough#
Note that in the code snippets below, upstream refers to the root repository on
GitHub and origin to its fork in your personal GitHub repositories. You may
need to make adjustments if you have not forked the repository but simply
cloned it locally. You can also edit .git/config and add upstream if it
isn’t already present.
1. Tag the release commit#
Checkout the branch for the release, make sure it is up to date, and clean the repository:
$ git checkout maintenance/2.4.x
$ git pull upstream maintenance/2.4.x
$ git submodule update
$ git clean -xdfq
Sanity check:
$ python3 -m spin test -m full
Tag the release and push the tag. This requires write permission for the numpy repository:
$ git tag -a -s v2.4.0 -m"NumPy 2.4.0 release"
$ git push upstream v2.4.0
If you need to delete the tag due to error:
$ git tag -d v2.4.0
$ git push --delete upstream v2.4.0
2. Build wheels and sdist#
Go to the numpy-release repository in your browser and manually trigger the
workflow on the maintenance/2.4.x branch using the Run workflow button
in actions. Make sure that the upload target is pypi in the
evironment dropdown. the wheels take about 1 hour to build, but sometimes
GitHub is very slow. If some wheel builds fail for unrelated reasons, you can
re-run them as normal in the GitHub Actions UI with re-run failed. After
the wheels are built review the results, checking that the number of artifacts
are correct, the wheel names are as expected, etc. If everything looks good
trigger the upload.
3. Upload files to GitHub Releases#
Go to numpy/numpy, there should be a v2.4.0
tag, click on it and hit the edit button for that tag and update the title to
“v2.4.0 (<date>)”. There are two ways to add files, using an editable text
window and as binary uploads. The text window needs markdown, so translate the
release notes from rst to md:
$ python tools/write_release.py 2.4.0
this will create a release/README.md file that you can edit. Check the
result to see that it looks correct. Things that may need fixing: wrapped lines
that need unwrapping and links that should be changed to monospaced text. Then
copy the contents to the clipboard and paste them into the text window. It may
take several tries to get it look right. Then
Download the sdist (
numpy-2.4.0.tar.gz) from PyPI and upload it to GitHub as a binary file. You cannot do this using pip.Upload
release/README.rstas a binary file.Upload
doc/changelog/2.4.0-changelog.rstas a binary file.Check the pre-release button if this is a pre-releases.
Hit the
Publish releasebutton at the bottom.
Note
Please ensure that all 3 files are uploaded are present and the release text is complete. Releases are configured to be immutable, so mistakes can’t (easily) be fixed anymore.
4. Upload documents to numpy.org (skip for prereleases)#
Note
You will need a GitHub personal access token to push the update.
This step is only needed for final releases and can be skipped for pre-releases
and most patch releases. make merge-doc clones the numpy/doc repo into
doc/build/merge and updates it with the new documentation:
$ git clean -xdfq
$ git co v2.4.0
$ rm -rf doc/build # want version to be current
$ python -m spin docs merge-doc --build
$ pushd doc/build/merge
If the release series is a new one, you will need to add a new section to the
doc/build/merge/index.html front page just after the “insert here” comment:
$ gvim index.html +/'insert here'
Further, update the version-switcher json file to add the new release and
update the version marked (stable) and preferred:
$ gvim _static/versions.json
Then run update.py to update the version in _static:
$ python3 update.py
You can “test run” the new documentation in a browser to make sure the links
work, although the version dropdown will not change, it pulls its information
from numpy.org:
$ firefox index.html # or google-chrome, etc.
Update the stable link and update:
$ ln -sfn 2.4 stable
$ ls -l # check the link
Once everything seems satisfactory, update, commit and upload the changes:
$ git commit -a -m"Add documentation for v2.4.0"
$ git push [email protected]:numpy/doc
$ popd
5. Reset the maintenance branch into a development state (skip for prereleases)#
Create release notes for next release and edit them to set the version. These notes will be a skeleton and have little content:
$ git checkout -b begin-2.4.1 maintenance/2.4.x
$ cp doc/source/release/template.rst doc/source/release/2.4.1-notes.rst
$ gvim doc/source/release/2.4.1-notes.rst
$ git add doc/source/release/2.4.1-notes.rst
Add a link to the new release notes:
$ gvim doc/source/release.rst
Update the version in pyproject.toml:
$ gvim pyproject.toml
Commit the result, edit the commit message, note the files in the commit, and
add a line [skip azp] [skip cirrus] [skip actions], then push:
$ git commit -a -m"MAINT: Prepare 2.4.x for further development"
$ git rebase -i HEAD^
$ git push origin HEAD
Go to GitHub and make a PR. It should be merged quickly.
6. Announce the release on numpy.org (skip for prereleases)#
This assumes that you have forked numpy/numpy.org:
$ cd ../numpy.org
$ git checkout main
$ git pull upstream main
$ git checkout -b announce-numpy-2.4.0
$ gvim content/en/news.md
For all releases, go to the bottom of the page and add a one line link. Look to the previous links for example.
For the
*.0release in a cycle, add a new section at the top with a short description of the new features and point the news link to it.Edit the newsHeader and date fields at the top of news.md
Also edit the buttonText on line 14 in content/en/config.yaml
commit and push:
$ git commit -a -m"announce the NumPy 2.4.0 release"
$ git push origin HEAD
Go to GitHub and make a PR.
7. Announce to mailing lists#
The release should be announced on the numpy-discussion and python-announce-list mailing lists. Look at previous announcements for the basic template. The contributor and PR lists are the same as generated for the release notes above. If you cross-post, make sure that python-announce-list is BCC so that replies will not be sent to that list.
8. Post-release update main (skip for prereleases)#
Checkout main and forward port the documentation changes. You may also want to update these notes if procedures have changed or improved:
$ git checkout -b post-2.4.0-release-update main
$ git checkout maintenance/2.4.x doc/source/release/2.4.0-notes.rst
$ git checkout maintenance/2.4.x doc/changelog/2.4.0-changelog.rst
$ git checkout maintenance/2.4.x .mailmap # only if updated for release.
$ gvim doc/source/release.rst # Add link to new notes
$ git status # check status before commit
$ git commit -a -m"MAINT: Update main after 2.4.0 release."
$ git push origin HEAD
Go to GitHub and make a PR.
Branch walkthrough#
This guide contains a walkthrough of branching NumPy 2.3.x on Linux. The
commands can be copied into the command line, but be sure to replace 2.3 and
2.4 by the correct versions. It is good practice to make .mailmap as
current as possible before making the branch, that may take several weeks.
This should be read together with the general release guide.
Branching#
Make the branch#
This is only needed when starting a new maintenance branch. The start of a new development cycle in the main branch should get an annotated tag. That is done as follows:
$ git checkout main
$ git pull upstream main
$ git commit --allow-empty -m'REL: Begin NumPy 2.4.0 development'
$ git push upstream HEAD
If the push fails because new PRs have been merged, do:
$ git pull --rebase upstream
and repeat the push. Once the push succeeds, tag it:
$ git tag -a -s v2.4.0.dev0 -m'Begin NumPy 2.4.0 development'
$ git push upstream v2.4.0.dev0
then make the new branch and push it:
$ git branch maintenance/2.3.x HEAD^
$ git push upstream maintenance/2.3.x
Prepare the main branch for further development#
Make a PR branch to prepare main for further development:
$ git checkout -b 'prepare-main-for-2.4.0-development' v2.4.0.dev0
Delete the release note fragments:
$ git rm doc/release/upcoming_changes/[0-9]*.*.rst
Create the new release notes skeleton and add to index:
$ cp doc/source/release/template.rst doc/source/release/2.4.0-notes.rst
$ gvim doc/source/release/2.4.0-notes.rst # put the correct version
$ git add doc/source/release/2.4.0-notes.rst
$ gvim doc/source/release.rst # add new notes to notes index
$ git add doc/source/release.rst
Update cversions.txt to add current release. There should be no new hash
to worry about at this early point, just add a comment following previous
practice:
$ gvim numpy/_core/code_generators/cversions.txt
$ git add numpy/_core/code_generators/cversions.txt
Check your work, commit it, and push:
$ git status # check work
$ git commit -m'REL: Prepare main for NumPy 2.4.0 development'
$ git push origin HEAD
Now make a pull request.