Skip to content

docs: update contributing/release guide a little #5681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,21 @@ build only one of the valid targets (listed below).
```bash
cmake --preset venv -DPYBIND11_CREATE_WITH_UV=3.13t
cmake --build --preset venv
cmake --build --preset testsvenv -t cpptest
cmake --build --preset venv -t cpptest
```

The `default` preset will use an existing venv or Python install.
The `default` preset will use an existing venv or Python install. If you'd like
to run pytest yourself, say to easily control the options:

```bash
cd build
source .venv/bin/activate
cd tests
python -m pytest
```

The `.so` file is not installed into the venv, so you need to run from this
directory, the local directory is included with `python -m`.

## Configuration options

Expand Down
39 changes: 15 additions & 24 deletions docs/release.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
On version numbers
^^^^^^^^^^^^^^^^^^

The two version numbers (C++ and Python) must match when combined (checked when
you build the PyPI package), and must be a valid `PEP 440
<https://www.python.org/dev/peps/pep-0440>`_ version when combined.
The version number must be a valid `PEP 440
<https://www.python.org/dev/peps/pep-0440>`_ version number.

For example:

.. code-block:: C++

#define PYBIND11_VERSION_MAJOR X
#define PYBIND11_VERSION_MINOR Y
#define PYBIND11_VERSION_PATCH Z.dev1
#define PYBIND11_VERSION_PATCH Za0

For beta, ``PYBIND11_VERSION_PATCH`` should be ``Z.b1``. RC's can be ``Z.rc1``.
Always include the dot (even though PEP 440 allows it to be dropped). For a
final release, this must be a simple integer. There is also
For beta, ``PYBIND11_VERSION_PATCH`` should be ``Zb1``. RC's can be ``Zrc1``.
For a final release, this must be a simple integer. There is also
``PYBIND11_VERSION_HEX`` just below that needs to be updated.


To release a new version of pybind11:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you don't have nox, you should either use ``pipx run nox`` instead, or use
``pipx install nox`` or ``brew install nox`` (Unix).
``uv tool install nox``, ``pipx install nox``, or ``brew install nox`` (Unix).

- Update the version number

Expand All @@ -32,11 +30,9 @@ If you don't have nox, you should either use ``pipx run nox`` instead, or use

- Update ``PYBIND11_VERSION_HEX`` just below as well.

- Update ``pybind11/_version.py`` (match above).

- Run ``nox -s tests_packaging`` to ensure this was done correctly.

- Ensure that all the information in ``setup.cfg`` is up-to-date, like
- Ensure that all the information in ``pyproject.toml`` is up-to-date, like
supported Python versions.

- Add release date in ``docs/changelog.md`` and integrate the output of
Expand All @@ -63,7 +59,7 @@ If you don't have nox, you should either use ``pipx run nox`` instead, or use

- ``git tag -a vX.Y.Z -m 'vX.Y.Z release'``

- ``grep ^__version__ pybind11/_version.py``
- ``git grep PYBIND11_VERSION include/pybind11/detail/common.h``

- Last-minute consistency check: same as tag?

Expand All @@ -90,9 +86,9 @@ If you don't have nox, you should either use ``pipx run nox`` instead, or use
click "Draft a new release" on the far right, fill in the tag name
(if you didn't tag above, it will be made here), fill in a release name
like "Version X.Y.Z", and copy-and-paste the markdown-formatted (!) changelog
into the description. You can remove line breaks and strip links to PRs and
issues, e.g. to a bare ``#1234`` without the hyperlink markup. Check
"pre-release" if this is a beta/RC.
into the description. You can remove line breaks and optionally strip links
to PRs and issues, e.g. to a bare ``#1234`` without the hyperlink markup.
Check "pre-release" if this is an alpha/beta/RC.

- CLI method: with ``gh`` installed, run ``gh release create vX.Y.Z -t "Version X.Y.Z"``
If this is a pre-release, add ``-p``.
Expand All @@ -102,7 +98,7 @@ If you don't have nox, you should either use ``pipx run nox`` instead, or use
- Make sure you are on master, not somewhere else: ``git checkout master``

- Update version macros in ``include/pybind11/detail/common.h`` (set PATCH to
``0.dev1`` and increment MINOR).
``0a0`` and increment MINOR).

- Update ``pybind11/_version.py`` to match.

Expand All @@ -113,16 +109,10 @@ If you don't have nox, you should either use ``pipx run nox`` instead, or use

- ``git add``, ``git commit``, ``git push``

If a version branch is updated, remember to set PATCH to ``1.dev1``.

If you'd like to bump homebrew, run:

.. code-block:: console

brew bump-formula-pr --url https://github.com/pybind/pybind11/archive/vX.Y.Z.tar.gz
If a version branch is updated, remember to set PATCH to ``1a0``.

Conda-forge should automatically make a PR in a few hours, and automatically
merge it if there are no issues.
merge it if there are no issues. Homebrew should be automatic, too.


Manual packaging
Expand All @@ -137,6 +127,7 @@ this is the procedure:
.. code-block:: bash

nox -s build
nox -s build_global
twine upload dist/*

This makes SDists and wheels, and the final line uploads them.
Loading