blob: 9c3d945d4f67fb7b616f2e8ccc8b5622204e92d8 [file] [log] [blame]
Henry Schreiner82dbc5b2020-09-30 15:48:08 -04001On version numbers
2^^^^^^^^^^^^^^^^^^
Sylvain Corlay97dc8102016-02-01 09:51:35 -05003
Henry Schreiner82dbc5b2020-09-30 15:48:08 -04004The two version numbers (C++ and Python) must match when combined (checked when
5you build the PyPI package), and must be a valid `PEP 440
6<https://www.python.org/dev/peps/pep-0440>`_ version when combined.
7
8For example:
9
10.. code-block:: C++
11
12 #define PYBIND11_VERSION_MAJOR X
13 #define PYBIND11_VERSION_MINOR Y
14 #define PYBIND11_VERSION_PATCH Z.dev1
15
16For beta, ``PYBIND11_VERSION_PATCH`` should be ``Z.b1``. RC's can be ``Z.rc1``.
17Always include the dot (even though PEP 440 allows it to be dropped). For a
18final release, this must be a simple integer.
19
20
21To release a new version of pybind11:
22^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23
24- Update the version number
25 - Update ``PYBIND11_VERSION_MAJOR`` etc. in
26 ``include/pybind11/detail/common.h``. PATCH should be a simple integer.
27 - Update ``pybind11/_version.py`` (match above)
28 - Ensure that all the information in ``setup.py`` is up-to-date.
29 - Add release date in ``docs/changelog.rst``.
30 - ``git add`` and ``git commit``, ``git push``. **Ensure CI passes**. (If it
31 fails due to a known flake issue, either ignore or restart CI.)
32- Add a release branch if this is a new minor version
33 - ``git checkout -b vX.Y``, ``git push -u origin vX.Y``
34- Update tags
35 - ``git tag -a vX.Y.Z -m 'vX.Y.Z release'``.
36 - ``git push --tags``.
37- Update stable
38 - ``git checkout stable``
39 - ``git merge master``
Wenzel Jakobace7b432016-05-10 13:09:05 +010040 - ``git push``
Henry Schreiner82dbc5b2020-09-30 15:48:08 -040041- Make a GitHub release (this shows up in the UI, sends new release
42 notifications to users watching releases, and also uploads PyPI packages).
43 (Note: if you do not use an existing tag, this creates a new lightweight tag
44 for you, so you could skip the above step).
45 - GUI method: click "Create a new release" on the far right, fill in the tag
46 name, fill in a release name like "Version X.Y.Z", and optionally
47 copy-and-paste the changelog into the description (processed as markdown by
48 Pandoc). Check "pre-release" if this is a beta/RC.
49 - CLI method: with ``gh`` installed, run ``gh release create vX.Y.Z -t "Version X.Y.Z"``
50 If this is a pre-release, add ``-p``.
51
Sylvain Corlaye6464ad2016-03-08 19:31:52 -050052- Get back to work
Henry Schreiner82dbc5b2020-09-30 15:48:08 -040053 - Make sure you are on master, not somewhere else: ``git checkout master``
54 - Update version macros in ``include/pybind11/common.h`` (set PATCH to
55 ``0.dev1`` and increment MINOR).
56 - Update ``_version.py`` to match
57 - Add a plot for in-development updates in ``docs/changelog.rst``.
58 - ``git add``, ``git commit``, ``git push``
59
60If a version branch is updated, remember to set PATCH to ``1.dev1``.
61
62
63Manual packaging
64^^^^^^^^^^^^^^^^
65
66If 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:
67
68.. code-block:: bash
69
70 python3 -m pip install build
71 python3 -m build
72 PYBIND11_SDIST_GLOBAL=1 python3 -m build
73 twine upload dist/*
74
75This makes SDists and wheels, and the final line uploads them.