| 1 |
.. _core_developer_guide: |
| 2 |
|
| 3 |
================================= |
| 4 |
Guide for IPython core Developers |
| 5 |
================================= |
| 6 |
|
| 7 |
This guide documents the development of IPython itself. Alternatively, |
| 8 |
developers of third party tools and libraries that use IPython should see the |
| 9 |
:doc:`../development/index`. |
| 10 |
|
| 11 |
|
| 12 |
For instructions on how to make a developer install see :ref:`devinstall`. |
| 13 |
|
| 14 |
Backporting Pull requests |
| 15 |
========================= |
| 16 |
|
| 17 |
All pull requests should usually be made against ``main``, if a Pull Request |
| 18 |
need to be backported to an earlier release; then it should be tagged with the |
| 19 |
correct ``milestone``. |
| 20 |
|
| 21 |
If you tag a pull request with a milestone **before** merging the pull request, |
| 22 |
and the base ref is ``main``, then our backport bot should automatically create |
| 23 |
a corresponding pull-request that backport on the correct branch. |
| 24 |
|
| 25 |
If you have write access to the IPython repository you can also just mention the |
| 26 |
**backport bot** to do the work for you. The bot is evolving so instructions may |
| 27 |
be different. At the time of this writing you can use:: |
| 28 |
|
| 29 |
@meeseeksdev[bot] backport [to] <branchname> |
| 30 |
|
| 31 |
The bot will attempt to backport the current pull-request and issue a PR if |
| 32 |
possible. |
| 33 |
|
| 34 |
.. note:: |
| 35 |
|
| 36 |
The ``@`` and ``[bot]`` when mentioning the bot should be optional and can |
| 37 |
be omitted. |
| 38 |
|
| 39 |
If the pull request cannot be automatically backported, the bot should tell you |
| 40 |
so on the PR and apply a "Need manual backport" tag to the origin PR. |
| 41 |
|
| 42 |
.. _release_process: |
| 43 |
|
| 44 |
IPython release process |
| 45 |
======================= |
| 46 |
|
| 47 |
This document contains the process that is used to create an IPython release. |
| 48 |
|
| 49 |
Conveniently, the ``release`` script in the ``tools`` directory of the ``IPython`` |
| 50 |
repository automates most of the release process. This document serves as a |
| 51 |
handy reminder and checklist for the release manager. |
| 52 |
|
| 53 |
During the release process, you might need the extra following dependencies: |
| 54 |
|
| 55 |
- ``keyring`` to access your GitHub authentication tokens |
| 56 |
- ``graphviz`` to generate some graphs in the documentation |
| 57 |
- ``ghpro`` to generate the stats |
| 58 |
|
| 59 |
Make sure you have all the required dependencies to run the tests as well. |
| 60 |
|
| 61 |
You can try to ``source tools/release_helper.sh`` when releasing via bash, it |
| 62 |
should guide you through most of the process. |
| 63 |
|
| 64 |
|
| 65 |
1. Set Environment variables |
| 66 |
---------------------------- |
| 67 |
|
| 68 |
Set environment variables to document previous release tag, current |
| 69 |
release milestone, current release version, and git tag. |
| 70 |
|
| 71 |
These variables may be used later to copy/paste as answers to the script |
| 72 |
questions instead of typing the appropriate command when the time comes. These |
| 73 |
variables are not used by the scripts directly; therefore, there is no need to |
| 74 |
``export`` them. The format for bash is as follows, but note that these values |
| 75 |
are just an example valid only for the 5.0 release; you'll need to update them |
| 76 |
for the release you are actually making:: |
| 77 |
|
| 78 |
PREV_RELEASE=4.2.1 |
| 79 |
MILESTONE=5.0 |
| 80 |
VERSION=5.0.0 |
| 81 |
BRANCH=main |
| 82 |
|
| 83 |
For `reproducibility of builds <https://reproducible-builds.org/specs/source-date-epoch/>`_, |
| 84 |
we recommend setting ``SOURCE_DATE_EPOCH`` prior to running the build; record the used value |
| 85 |
of ``SOURCE_DATE_EPOCH`` as it may not be available from build artifact. You |
| 86 |
should be able to use ``date +%s`` to get a formatted timestamp:: |
| 87 |
|
| 88 |
SOURCE_DATE_EPOCH=$(date +%s) |
| 89 |
|
| 90 |
|
| 91 |
2. Create GitHub stats and finish release note |
| 92 |
---------------------------------------------- |
| 93 |
|
| 94 |
.. note:: |
| 95 |
|
| 96 |
This step is optional if making a Beta or RC release. |
| 97 |
|
| 98 |
.. note:: |
| 99 |
|
| 100 |
Before generating the GitHub stats, verify that all closed issues and pull |
| 101 |
requests have `appropriate milestones |
| 102 |
<https://github.com/ipython/ipython/wiki/Dev:-GitHub-workflow#milestones>`_. |
| 103 |
`This search |
| 104 |
<https://github.com/ipython/ipython/issues?q=is%3Aclosed+no%3Amilestone+is%3Aissue>`_ |
| 105 |
should return no results before creating the GitHub stats. |
| 106 |
|
| 107 |
If a major release: |
| 108 |
|
| 109 |
- merge any pull request notes into what's new:: |
| 110 |
|
| 111 |
python tools/update_whatsnew.py |
| 112 |
|
| 113 |
- update ``docs/source/whatsnew/development.rst``, to ensure it covers |
| 114 |
the major release features |
| 115 |
|
| 116 |
- move the contents of ``development.rst`` to ``versionX.rst`` where ``X`` is |
| 117 |
the numerical release version |
| 118 |
|
| 119 |
- You do not need to temporarily remove the first entry called |
| 120 |
``development``, nor re-add it after the release, it will automatically be |
| 121 |
hidden when releasing a stable version of IPython (if ``_version_extra`` |
| 122 |
in ``release.py`` is an empty string. |
| 123 |
|
| 124 |
Make sure that the stats file has a header or it won't be rendered in |
| 125 |
the final documentation. |
| 126 |
|
| 127 |
To find duplicates and update `.mailmap`, use:: |
| 128 |
|
| 129 |
git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f |
| 130 |
|
| 131 |
If a minor release you might need to do some of the above points manually, and |
| 132 |
forward port the changes. |
| 133 |
|
| 134 |
3. Make sure the repository is clean |
| 135 |
------------------------------------ |
| 136 |
|
| 137 |
of any file that could be problematic. |
| 138 |
Remove all non-tracked files with: |
| 139 |
|
| 140 |
.. code:: |
| 141 |
|
| 142 |
git clean -xfdi |
| 143 |
|
| 144 |
This will ask for confirmation before removing all untracked files. Make |
| 145 |
sure the ``dist/`` folder is clean to avoid any stale builds from |
| 146 |
previous build attempts. |
| 147 |
|
| 148 |
|
| 149 |
4. Update the release version number |
| 150 |
------------------------------------ |
| 151 |
|
| 152 |
Edit ``IPython/core/release.py`` to have the current version. |
| 153 |
|
| 154 |
in particular, update version number and ``_version_extra`` content in |
| 155 |
``IPython/core/release.py``. |
| 156 |
|
| 157 |
Step 5 will validate your changes automatically, but you might still want to |
| 158 |
make sure the version number matches pep440. |
| 159 |
|
| 160 |
In particular, ``rc`` and ``beta`` are not separated by ``.`` or the ``sdist`` |
| 161 |
and ``bdist`` will appear as different releases. For example, a valid version |
| 162 |
number for a release candidate (rc) release is: ``1.3rc1``. Notice that there |
| 163 |
is no separator between the '3' and the 'r'. Check the environment variable |
| 164 |
``$VERSION`` as well. |
| 165 |
|
| 166 |
You will likely just have to modify/comment/uncomment one of the lines setting |
| 167 |
``_version_extra`` |
| 168 |
|
| 169 |
|
| 170 |
5. Run the `tools/build_release` script |
| 171 |
--------------------------------------- |
| 172 |
|
| 173 |
Running ``tools/build_release`` does all the file checking and building that |
| 174 |
the real release script will do. This makes test installations, checks that |
| 175 |
the build procedure runs OK, and tests other steps in the release process. |
| 176 |
|
| 177 |
The ``build_release`` script will in particular verify that the version number |
| 178 |
match PEP 440, in order to avoid surprise at the time of build upload. |
| 179 |
|
| 180 |
We encourage creating a test build of the docs as well. |
| 181 |
|
| 182 |
6. Create and push the new tag |
| 183 |
------------------------------ |
| 184 |
|
| 185 |
Commit the changes to release.py:: |
| 186 |
|
| 187 |
git commit -am "release $VERSION" -S |
| 188 |
git push origin $BRANCH |
| 189 |
|
| 190 |
(omit the ``-S`` if you are no signing the package) |
| 191 |
|
| 192 |
Create and push the tag:: |
| 193 |
|
| 194 |
git tag -am "release $VERSION" "$VERSION" -s |
| 195 |
git push origin $VERSION |
| 196 |
|
| 197 |
(omit the ``-s`` if you are no signing the package) |
| 198 |
|
| 199 |
Update release.py back to ``x.y-dev`` or ``x.y-maint`` commit and push:: |
| 200 |
|
| 201 |
git commit -am "back to development" -S |
| 202 |
git push origin $BRANCH |
| 203 |
|
| 204 |
(omit the ``-S`` if you are no signing the package) |
| 205 |
|
| 206 |
Now checkout the tag we just made:: |
| 207 |
|
| 208 |
git checkout $VERSION |
| 209 |
|
| 210 |
7. Run the release script |
| 211 |
------------------------- |
| 212 |
|
| 213 |
Run the ``release`` script, this step requires having a current wheel, Python |
| 214 |
>=3.4 and Python 2.7.:: |
| 215 |
|
| 216 |
./tools/release |
| 217 |
|
| 218 |
This makes the tarballs and wheels, and puts them under the ``dist/`` |
| 219 |
folder. Be sure to test the ``wheels`` and the ``sdist`` locally before |
| 220 |
uploading them to PyPI. We do not use an universal wheel as each wheel |
| 221 |
installs an ``ipython2`` or ``ipython3`` script, depending on the version of |
| 222 |
Python it is built for. Using an universal wheel would prevent this. |
| 223 |
|
| 224 |
Check the shasum of files with:: |
| 225 |
|
| 226 |
shasum -a 256 dist/* |
| 227 |
|
| 228 |
and takes notes of them you might need them to update the conda-forge recipes. |
| 229 |
Rerun the command and check the hash have not changed:: |
| 230 |
|
| 231 |
./tools/release |
| 232 |
shasum -a 256 dist/* |
| 233 |
|
| 234 |
Use the following to actually upload the result of the build:: |
| 235 |
|
| 236 |
./tools/release upload |
| 237 |
|
| 238 |
It should posts them to ``archive.ipython.org`` and to PyPI. |
| 239 |
|
| 240 |
PyPI/Warehouse will automatically hide previous releases. If you are uploading |
| 241 |
a non-stable version, make sure to log-in to PyPI and un-hide previous version. |
| 242 |
|
| 243 |
|
| 244 |
8. Draft a short release announcement |
| 245 |
------------------------------------- |
| 246 |
|
| 247 |
The announcement should include: |
| 248 |
|
| 249 |
- release highlights |
| 250 |
- a link to the html version of the *What's new* section of the documentation |
| 251 |
- a link to upgrade or installation tips (if necessary) |
| 252 |
|
| 253 |
Post the announcement to the mailing list and or blog, and link from Twitter. |
| 254 |
|
| 255 |
.. note:: |
| 256 |
|
| 257 |
If you are doing a RC or Beta, you can likely skip the next steps. |
| 258 |
|
| 259 |
9. Update milestones on GitHub |
| 260 |
------------------------------- |
| 261 |
|
| 262 |
These steps will bring milestones up to date: |
| 263 |
|
| 264 |
- close the just released milestone |
| 265 |
- open a new milestone for the next release (x, y+1), if the milestone doesn't |
| 266 |
exist already |
| 267 |
|
| 268 |
10. Update the IPython website |
| 269 |
------------------------------ |
| 270 |
|
| 271 |
The IPython website should document the new release: |
| 272 |
|
| 273 |
- add release announcement (news, announcements) |
| 274 |
- update current version and download links |
| 275 |
- update links on the documentation page (especially if a major release) |
| 276 |
|
| 277 |
11. Update readthedocs |
| 278 |
---------------------- |
| 279 |
|
| 280 |
Make sure to update readthedocs and set the latest tag as stable, as well as |
| 281 |
checking that previous release is still building under its own tag. |
| 282 |
|
| 283 |
12. Update the Conda-Forge feedstock |
| 284 |
------------------------------------ |
| 285 |
|
| 286 |
Follow the instructions on `the repository <https://github.com/conda-forge/ipython-feedstock>`_ |
| 287 |
|
| 288 |
13. Celebrate! |
| 289 |
-------------- |
| 290 |
|
| 291 |
Celebrate the release and please thank the contributors for their work. Great |
| 292 |
job! |
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
Old Documentation |
| 297 |
================= |
| 298 |
|
| 299 |
Out of date documentation is still available and have been kept for archival purposes. |
| 300 |
|
| 301 |
.. note:: |
| 302 |
|
| 303 |
Developers documentation used to be on the IPython wiki, but are now out of |
| 304 |
date. The wiki is though still available for historical reasons: `Old IPython |
| 305 |
GitHub Wiki. <https://github.com/ipython/ipython/wiki/Dev:-Index>`_ |