@@ -57,81 +57,121 @@ permissions given to maintainers, which includes:
5757Preparing a release PR
5858......................
5959
60- Releasing the first RC of e.g. version `0.99 ` involves creating the release
60+ Major version release
61+ ~~~~~~~~~~~~~~~~~~~~~
62+
63+ Prior to branching please do not forget to prepare a Release Highlights page as
64+ a runnable example and check that its HTML rendering looks correct. These
65+ release highlights should be linked from the ``doc/whats_new/v0.99.rst `` file
66+ for the new version of scikit-learn.
67+
68+ Releasing the first RC of e.g. version `0.99.0 ` involves creating the release
6169branch `0.99.X ` directly on the main repo, where `X ` really is the letter X,
62- **not a placeholder **. This is considered the *feature freeze *. The
63- development for the major and minor releases of 0.99 should
64- **also ** happen under `0.99.X `. Each release (rc, major, or minor) is a tag
65- under that branch.
70+ **not a placeholder **. The development for the major and minor releases of `0.99 `
71+ should **also ** happen under `0.99.X `. Each release (rc, major, or minor) is a
72+ tag under that branch.
73+
74+ This is done only once, as the major and minor releases happen on the same
75+ branch:
76+
77+ .. prompt :: bash $
78+
79+ # Assuming upstream is an alias for the main scikit-learn repo:
80+ git fetch upstream master
81+ git checkout upstream/master
82+ git checkout -b 0.99.X
83+ git push --set-upstream upstream 0.99.X
84+
85+ Again, `X ` is literal here, and `99 ` is replaced by the release number.
86+ The branches are called ``0.19.X ``, ``0.20.X ``, etc.
6687
6788In terms of including changes, the first RC ideally counts as a *feature
6889freeze *. Each coming release candidate and the final release afterwards will
69- include minor documentation changes and bug fixes. Any major enhancement or
70- feature should be excluded.
90+ include only minor documentation changes and bug fixes. Any major enhancement
91+ or feature should be excluded.
92+
93+ Then you can prepare a local branch for the release itself, for instance:
94+ ``release-0.99.0rc1 ``, push it to your github fork and open a PR **to the **
95+ `scikit-learn/0.99.X ` **branch **. Copy the :ref: `release_checklist ` templates
96+ in the description of the Pull Request to track progress.
97+
98+ This PR will be used to push commits related to the release as explained in
99+ :ref: `making_a_release `.
100+
101+ You can also create a second PR from master and targeting master to increment
102+ the ``__version__ `` variable in `sklearn/__init__.py ` to increment the dev
103+ version. This means while we're in the release candidate period, the latest
104+ stable is two versions behind the master branch, instead of one. In this PR
105+ targeting master you should also include a new file for the matching version
106+ under the ``doc/whats_new/ `` folder so PRs that target the next version can
107+ contribute their changelog entries to this file in parallel to the release
108+ process.
109+
110+ Minor version release
111+ ~~~~~~~~~~~~~~~~~~~~~
71112
72113The minor releases should include bug fixes and some relevant documentation
73114changes only. Any PR resulting in a behavior change which is not a bug fix
74115should be excluded.
75116
76- First, create a branch, **on your own fork ** (to release e.g. `0.999 .3 `):
117+ First, create a branch, **on your own fork ** (to release e.g. `0.99 .3 `):
77118
78119.. prompt :: bash $
79120
80121 # assuming master and upstream/master are the same
81- git checkout -b release-0.999 .3 master
122+ git checkout -b release-0.99 .3 master
82123
83- Then, create a PR **to the ** `scikit-learn/0.999 .X ` **branch ** (not to
124+ Then, create a PR **to the ** `scikit-learn/0.99 .X ` **branch ** (not to
84125master!) with all the desired changes:
85126
86127.. prompt :: bash $
87128
88- git rebase -i upstream/0.999 .2
129+ git rebase -i upstream/0.99 .2
89130
90- Do not forget to add a commit updating sklearn.__version__.
131+ Copy the :ref: `release_checklist ` templates in the description of the Pull
132+ Request to track progress.
133+
134+ Do not forget to add a commit updating ``sklearn.__version__ ``.
91135
92136It's nice to have a copy of the ``git rebase -i `` log in the PR to help others
93137understand what's included.
94138
139+ .. _making_a_release :
140+
95141Making a release
96142................
97143
98- 0. Create the release branch on the main repo, if it does not exist. This is
99- done only once, as the major and minor releases happen on the same branch:
100-
101- .. prompt :: bash $
102-
103- git checkout -b 0.99.X
104-
105- Again, `X ` is literal here, and `99 ` is replaced by the release number.
106- The branches are called ``0.19.X ``, ``0.20.X ``, etc.
144+ 0. Ensure that you have checked out the branch of the release PR as explained
145+ in :ref: `preparing_a_release_pr ` above.
107146
1081471. Update docs. Note that this is for the final release, not necessarily for
109148 the RC releases. These changes should be made in master and cherry-picked
110149 into the release branch, only before the final release.
111150
112- - Edit the doc/whats_new.rst file to add release title and commit
113- statistics. You can retrieve commit statistics with:
151+ - Edit the ``doc/whats_new/v0.99.rst `` file to add release title and list of
152+ contributors.
153+ You can retrieve the list of contributor names with:
114154
115155 ::
116156
117- $ git shortlog -s 0.99.33.. | cut -f2- | sort --ignore-case | tr '\n' ';' | sed 's/;/, /g;s/, $//'
157+ $ git shortlog -s 0.98.33.. | cut -f2- | sort --ignore-case | tr '\n' ';' | sed 's/;/, /g;s/, $//' | fold -s
158+
159+ - For major releases, link the release highlights example from the ``doc/whats_new/v0.99.rst `` file.
118160
119161 - Update the release date in ``whats_new.rst ``
120162
121- - Edit the doc/templates/index.html to change the 'News' entry of the front
122- page.
163+ - Edit the `` doc/templates/index.html `` to change the 'News' entry of the
164+ front page (with the release month as well) .
123165
1241662. On the branch for releasing, update the version number in
125- `sklearn/__init__.py `, the ``__version__ `` variable by removing ``dev* ``
126- only when ready to release. On master, increment the version in the same
127- place (when branching for release). This means while we're in the release
128- candidate period, the latest stable is two versions behind the master
129- branch, instead of one.
130-
131- 3. Proceed with caution. Ideally, tags should be created when you're almost
132- certain that the release is ready, since adding a tag to the main repo can
133- trigger certain automated processes. You can create a PR in the main repo
134- and trigger the wheel builder with the ``[cd build] `` commit marker using
167+ ``sklearn/__init__.py ``, the ``__version__ ``.
168+
169+ For major releases, please add a 0 at the end: `0.99.0 ` instead of `0.99 `.
170+
171+ For the first release candidate, use the `rc1 ` suffix on the expected final
172+ release number: `0.99.0rc1 `.
173+
174+ 3. Trigger the wheel builder with the ``[cd build] `` commit marker using
135175 the command:
136176
137177 .. prompt :: bash $
@@ -141,36 +181,70 @@ Making a release
141181 The wheel building workflow is managed by GitHub Actions and the results be browsed at:
142182 https://github.com/scikit-learn/scikit-learn/actions?query=workflow%3A%22Wheel+builder%22
143183
144- Once all works, you can proceed with tagging. Create the tag and push it (if
145- it's an RC, it can be ``0.xxrc1 `` for instance):
184+ .. note ::
185+
186+ Before building the wheels, make sure that the ``pyproject.toml `` file is
187+ up to date and using the oldest version of ``numpy `` for each Python version
188+ to avoid `ABI <https://en.wikipedia.org/wiki/Application_binary_interface >`_
189+ incompatibility issues. Moreover, a new line have to be included in the
190+ ``pyproject.toml `` file for each new supported version of Python.
191+
192+ .. note ::
193+
194+ The acronym CD in `[cd build] ` stands for `Continuous Delivery
195+ <https://en.wikipedia.org/wiki/Continuous_delivery> `_ and refers to the
196+ automation used to generate the release artifacts (binary and source
197+ packages). This can be seen as an extension to CI which stands for
198+ `Continuous Integration
199+ <https://en.wikipedia.org/wiki/Continuous_integration> `_. The CD workflow on
200+ GitHub Actions is also used to automatically create nightly builds and
201+ publish packages for the developement branch of scikit-learn. See
202+ :ref: `install_nightly_builds `.
203+
204+ 4. Once all the CD jobs have completed successfully in the PR, merge it,
205+ again with the `[cd build] ` marker in the commit message. This time
206+ the results will be uploaded to the staging area.
207+
208+ You should then be able to upload the generated artifacts (.tar.gz and .whl
209+ files) to https://test.pypi.org using the "Run workflow" form for the
210+ following GitHub Actions workflow:
211+
212+ https://github.com/scikit-learn/scikit-learn/actions?query=workflow%3A%22Publish+to+Pypi%22
213+
214+ 5. If this went fine, you can proceed with tagging. Proceed with caution.
215+ Ideally, tags should be created when you're almost certain that the release
216+ is ready, since adding a tag to the main repo can trigger certain automated
217+ processes.
218+
219+ Create the tag and push it (if it's an RC, it can be ``0.xx.0rc1 `` for
220+ instance):
146221
147222<
8090
div class="diff-text-inner"> .. prompt :: bash $ 148223
149- git tag -a 0.99 # in the 0.99.X branch
150- git push git@github.com:scikit-learn/scikit-learn.git 0.99
224+ git tag -a 0.99.0 # in the 0.99.X branch
225+ git push git@github.com:scikit-learn/scikit-learn.git 0.99.0
151226
152- .. note ::
153-
154- Before building the wheels, make sure that the ``pyproject.toml `` file is
155- up to date and using the oldest version of ``numpy `` for each Python version
156- to avoid ABI incompatibility issues. Moreover, a new line have to be included
157- in the ``pyproject.toml `` file for each new supported version of Python.
227+ 6. Trigger the GitHub Actions workflow again but this time to upload the artifacts
228+ to the real https://pypi.org (replace "testpypi" by "pypi" in the "Run
229+ workflow" form).
158230
159- 4. Once the CD has completed successfully, collect the generated binary
160- wheel packages and upload them to PyPI by running the following commands
161- in the scikit-learn source folder (checked out at the release tag):
231+ 7. Alternatively, it's possible to collect locally the generated binary wheel
232+ packages and source tarball and upload them all to PyPI by running the
233+ following commands in the scikit-learn source folder (checked out at the
234+ release tag):
162235
163236 .. prompt :: bash $
164237
165238 rm -r dist
166239 pip install -U wheelhouse_uploader twine
167240 python setup.py fetch_artifacts
168241
169- This command will download all the binary packages accumulated in the `staging area on the anaconda.org
170- hosting service <https://anaconda.org/scikit-learn-wheels-staging/scikit-learn/files> `_ and put them in
171- your local `./dist ` folder.
242+ This command will download all the binary packages accumulated in the
243+ `staging area on the anaconda.org hosting service
244+ <https://anaconda.org/scikit-learn-wheels-staging/scikit-learn/files> `_ and
245+ put them in your local `./dist ` folder.
172246
173- 5. Check the content of the `./dist ` folder: it should contain all the wheels
247+ Check the content of the `./dist ` folder: it should contain all the wheels
174248 along with the source tarball ("scikit-learn-RRR.tar.gz").
175249
176250 Make sure that you do not have developer versions or older versions of
@@ -188,7 +262,7 @@ Making a release
188262
189263 twine upload dist/*
190264
191- 6 . For major/minor (not bug-fix release), update the symlink for ``stable ``
265+ 8 . For major/minor (not bug-fix release), update the symlink for ``stable ``
192266 and the ``latestStable `` variable in
193267 https://github.com/scikit-learn/scikit-learn.github.io:
194268
@@ -206,11 +280,20 @@ Making a release
206280 git commit -m "Update stable to point to 0.999"
207281 git push origin master
208282
283+ .. _release_checklist :
284+
285+ Release checklist
286+ .................
287+
209288The following GitHub checklist might be helpful in a release PR::
210289
211- * [ ] update news and what's new date in master and release branch
212- * [ ] create tag
213- * [ ] twine the wheels to PyPI when that's green
290+ * [ ] update news and what's new date in release branch
291+ * [ ] update news and what's new date and sklearn dev0 version in master branch
292+ * [ ] check that the for the release wheels can be built successfully
293+ * [ ] merge the PR with `[cd build]` commit message to upload wheels to the staging repo
294+ * [ ] upload the wheels and source tarball to https://test.pypi.org
295+ * [ ] create tag on the main github repo
296+ * [ ] upload the wheels and source tarball to PyPI
214297 * [ ] https://github.com/scikit-learn/scikit-learn/releases draft
215298 * [ ] confirm bot detected at
216299 https://github.com/conda-forge/scikit-learn-feedstock and wait for merge
0 commit comments