release.rst 4.24 KB
Newer Older
Henry Schreiner's avatar
Henry Schreiner committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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.

For example:

.. code-block:: C++

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

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
Henry Schreiner's avatar
Henry Schreiner committed
18
19
final release, this must be a simple integer. There is also a HEX version of
the version just below.
Henry Schreiner's avatar
Henry Schreiner committed
20
21


22
To release a new version of pybind11:
Henry Schreiner's avatar
Henry Schreiner committed
23
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24

Henry Schreiner's avatar
Henry Schreiner committed
25
- Update the version number
Henry Schreiner's avatar
Henry Schreiner committed
26
27
28
29
    - Update ``PYBIND11_VERSION_MAJOR`` etc. in
      ``include/pybind11/detail/common.h``. PATCH should be a simple integer.
    - Update the version HEX just below, as well.
    - Update ``pybind11/_version.py`` (match above)
30
    - Run ``nox -s tests_packaging``` to ensure this was done correctly.
Henry Schreiner's avatar
Henry Schreiner committed
31
32
33
34
35
36
37
38
    - Ensure that all the information in ``setup.cfg`` is up-to-date, like
      supported Python versions.
    - Add release date in ``docs/changelog.rst``.
          - Check to make sure
            `needs-changelog <https://github.com/pybind/pybind11/pulls?q=is%3Apr+is%3Aclosed+label%3A%22needs+changelog%22>`_
            issues are entered in the changelog (clear the label when done).
    - ``git add`` and ``git commit``, ``git push``. **Ensure CI passes**. (If it
      fails due to a known flake issue, either ignore or restart CI.)
39
- Add a release branch if this is a new minor version, or update the existing release branch if it is a patch version
Henry Schreiner's avatar
Henry Schreiner committed
40
41
    - New branch: ``git checkout -b vX.Y``, ``git push -u origin vX.Y``
    - Update branch: ``git checkout vX.Y``, ``git merge <release branch>``, ``git push``
Henry Schreiner's avatar
Henry Schreiner committed
42
- Update tags (optional; if you skip this, the GitHub release makes a
Henry Schreiner's avatar
Henry Schreiner committed
43
44
45
    non-annotated tag for you)
    - ``git tag -a vX.Y.Z -m 'vX.Y.Z release'``.
    - ``git push --tags``.
Henry Schreiner's avatar
Henry Schreiner committed
46
47
48
- Update stable
    - ``git checkout stable``
    - ``git merge master``
49
    - ``git push``
Henry Schreiner's avatar
Henry Schreiner committed
50
51
52
53
- Make a GitHub release (this shows up in the UI, sends new release
  notifications to users watching releases, and also uploads PyPI packages).
  (Note: if you do not use an existing tag, this creates a new lightweight tag
  for you, so you could skip the above step).
Henry Schreiner's avatar
Henry Schreiner committed
54
55
56
57
58
59
60
61
    - GUI method: click "Create 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 optionally copy-and-paste the changelog into
      the description (processed as markdown by Pandoc). Check "pre-release" if
      this is a beta/RC. You can get partway there with
      ``cat docs/changelog.rst | pandoc -f rst -t gfm``.
    - 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``.
Henry Schreiner's avatar
Henry Schreiner committed
62

Sylvain Corlay's avatar
Sylvain Corlay committed
63
- Get back to work
Henry Schreiner's avatar
Henry Schreiner committed
64
65
66
67
    - 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).
    - Update ``_version.py`` to match
68
    - Run ``nox -s tests_packaging``` to ensure this was done correctly.
Henry Schreiner's avatar
Henry Schreiner committed
69
70
    - Add a spot for in-development updates in ``docs/changelog.rst``.
    - ``git add``, ``git commit``, ``git push``
Henry Schreiner's avatar
Henry Schreiner committed
71
72
73

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

74
75
76
77
78
79
80
81
82
If you'd like to bump homebrew, run:

.. code-block::

    brew bump-formula-pr --url https://github.com/pybind/pybind11/archive/vX.Y.Z.tar.gz

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

Henry Schreiner's avatar
Henry Schreiner committed
83
84
85
86
87
88
89
90
91
92
93
94
95
96

Manual packaging
^^^^^^^^^^^^^^^^

If you need to manually upload releases, you can download the releases from the job artifacts and upload them with twine. You can also make the files locally (not recommended in general, as your local directory is more likely to be "dirty" and SDists love picking up random unrelated/hidden files); this is the procedure:

.. code-block:: bash

    python3 -m pip install build
    python3 -m build
    PYBIND11_SDIST_GLOBAL=1 python3 -m build
    twine upload dist/*

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