Debian Codegraph @

docs/source/make_a_release.rst

raw
1 =====================
2 How to Make a Release
3 =====================
4
5 A core developer should use the following steps to create a release ``X.Y.Z`` of **hdmf**.
6
7 .. note::
8
9 Since the hdmf wheels do not include compiled code, they are considered
10 *pure* and could be generated on any supported platform.
11
12 That said, considering the instructions below have been tested on a Linux system,
13 they may have to be adapted to work on macOS or Windows.
14
15 -------------
16 Prerequisites
17 -------------
18
19 * All CI tests are passing on `GitHub Actions`_.
20
21 * You have a `GPG signing key`_.
22
23 * Dependency versions in ``requirements.txt``, ``requirements-dev.txt``, ``requirements-opt.txt``,
24 ``requirements-doc.txt``, and ``requirements-min.txt`` are up-to-date.
25
26 * Legal information and copyright dates in ``Legal.txt``, ``license.txt``, ``README.rst``,
27 ``docs/source/conf.py``, and any other files are up-to-date.
28
29 * Package information in ``setup.py`` is up-to-date.
30
31 * ``README.rst`` information is up-to-date.
32
33 * The ``hdmf-common-schema`` submodule is up-to-date. The version number should be checked manually in case syncing the
34 git submodule does not work as expected.
35
36 * Documentation reflects any new features and changes in HDMF functionality.
37
38 * Documentation builds locally.
39
40 * Documentation builds on the `ReadTheDocs project`_ on the "dev" build.
41
42 * Release notes have been prepared.
43
44 * An appropriate new version number has been selected.
45
46 -------------------------
47 Documentation conventions
48 -------------------------
49
50 The commands reported below should be evaluated in the same terminal session.
51
52 Commands to evaluate starts with a dollar sign. For example::
53
54 $ echo "Hello"
55 Hello
56
57 means that ``echo "Hello"`` should be copied and evaluated in the terminal.
58
59
60 -------------------------------------
61 Publish release on PyPI: Step-by-step
62 -------------------------------------
63
64 1. Make sure that all CI tests are passing on `GitHub Actions`_.
65
66
67 2. List all tags sorted by version.
68
69 .. code::
70
71 $ git tag -l | sort -V
72
73
74 3. Choose the next release version number and store it in a variable.
75
76 .. code::
77
78 $ release=X.Y.Z
79
80 .. warning::
81
82 To ensure the packages are uploaded on PyPI, tags must match this regular
83 expression: ``^[0-9]+.[0-9]+.[0-9]+$``.
84
85
86 4. Download the latest sources.
87
88 .. code::
89
90 $ cd /tmp && git clone --recurse-submodules [email protected]:hdmf-dev/hdmf && cd hdmf
91
92
93 5. Tag the release.
94
95 .. code::
96
97 $ git tag --sign -m "hdmf ${release}" ${release} origin/dev
98
99 .. warning::
100
101 This step requires a `GPG signing key`_.
102
103
104 6. Publish the release tag.
105
106 .. code::
107
108 $ git push origin ${release}
109
110 .. important::
111
112 This will trigger the "Deploy release" GitHub Actions workflow which will automatically upload the wheels
113 and source distribution to both the `HDMF PyPI project page`_ and a new `GitHub release`_
114 using the hdmf-bot account.
115
116
117 7. Check the status of the builds on `GitHub Actions`_.
118
119
120 8. Once the builds are completed, check that the distributions are available on `HDMF PyPI project page`_ and that
121 a new `GitHub release`_ was created.
122
123
124 9. Copy the release notes from ``CHANGELOG.md`` to the newly created `GitHub release`_.
125
126
127 10. Create a clean testing environment to test the installation.
128
129 On bash/zsh:
130
131 .. code::
132
133 $ python -m venv hdmf-${release}-install-test && \
134 source hdmf-${release}-install-test/bin/activate
135
136 On other shells, see the `Python instructions for creating a virtual environment`_.
137
138
139 11. Test the installation:
140
141 .. code::
142
143 $ pip install hdmf && \
144 python -c "import hdmf; print(hdmf.__version__)"
145
146
147 10. Cleanup
148
149 On bash/zsh:
150
151 .. code::
152
153 $ deactivate && \
154 rm -rf dist/* && \
155 rm -rf hdmf-${release}-install-test
156
157
158 .. _GPG signing key: https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key
159 .. _ReadTheDocs project: https://readthedocs.org/projects/hdmf/builds/
160 .. _GitHub Actions: https://github.com/hdmf-dev/hdmf/actions
161 .. _GitHub release: https://github.com/hdmf-dev/hdmf/releases
162 .. _HDMF PyPI project page: https://pypi.org/project/hdmf
163 .. _Python instructions for creating a virtual environment: https://docs.python.org/3/library/venv.html#creating-virtual-environments
164
165
166 --------------------------------------------
167 Publish release on conda-forge: Step-by-step
168 --------------------------------------------
169
170 .. warning::
171
172 Publishing on conda requires you to have the corresponding package version uploaded on
173 PyPI. So you have to do the PyPI and GitHub release before you do the conda release.
174
175 .. note::
176
177 Conda-forge maintains a bot called "regro-cf-autotick-bot" that regularly monitors PyPI for new releases of
178 packages that are also on conda-forge. When a new release is detected, usually within 24 hours of publishing
179 on PyPI, the bot will create a Pull Request with the correct modifications to the version and sha256 values
180 in ``meta.yaml``. If the requirements in ``setup.py`` have been changed, then you need to modify the
181 requirements/run section in ``meta.yaml`` manually to reflect these changes. Once tests pass, merge the PR,
182 and a new release will be published on Anaconda cloud. This is the easiest way to update the package version
183 on conda-forge.
184
185 In order to release a new version on conda-forge manually, follow the steps below:
186
187 1. Store the release version string (this should match the PyPI version that you already published).
188
189 .. code::
190
191 $ release=X.Y.Z
192
193
194 2. Fork the `hdmf-feedstock <https://github.com/conda-forge/hdmf-feedstock>`_ repository to your GitHub user account.
195
196
197 3. Clone the forked feedstock to your local filesystem.
198
199 Fill the YOURGITHUBUSER part.
200
201 .. code::
202
203 $ cd /tmp && git clone https://github.com/YOURGITHUBUSER/hdmf-feedstock.git
204
205
206 4. Download the corresponding source for the release version.
207
208 .. code::
209
210 $ cd /tmp && \
211 wget https://github.com/hdmf-dev/hdmf/releases/download/$release/hdmf-$release.tar.gz
212
213
214 5. Create a new branch.
215
216 .. code::
217
218 $ cd hdmf-feedstock && \
219 git checkout -b $release
220
221
222 6. Modify ``meta.yaml``.
223
224 Update the `version string (line 2) <https://github.com/conda-forge/hdmf-feedstock/blob/main/recipe/meta.yaml>`_ and
225 `sha256 (line 3) <https://github.com/conda-forge/hdmf-feedstock/blob/main/recipe/meta.yaml>`_.
226
227 We have to modify the sha and the version string in the ``meta.yaml`` file.
228
229 For linux flavors:
230
231 .. code::
232
233 $ sed -i "2s/.*/{% set version = \"$release\" %}/" recipe/meta.yaml
234 $ sha=$(openssl sha256 /tmp/hdmf-$release.tar.gz | awk '{print $2}')
235 $ sed -i "3s/.*/{$ set sha256 = \"$sha\" %}/" recipe/meta.yaml
236
237 For macOS:
238
239 .. code::
240
241 $ sed -i -- "2s/.*/{% set version = \"$release\" %}/" recipe/meta.yaml
242 $ sha=$(openssl sha256 /tmp/hdmf-$release.tar.gz | awk '{print $2}')
243 $ sed -i -- "3s/.*/{$ set sha256 = \"$sha\" %}/" recipe/meta.yaml
244
245 If the requirements in ``setup.py`` have been changed, then modify the requirements/run list in
246 the ``meta.yaml`` file to reflect these changes.
247
248
249 7. Push the changes to your fork.
250
251 .. code::
252
253 $ git push origin $release
254
255
256 8. Create a Pull Request.
257
258 Create a pull request against the `main feedstock repository <https://github.com/conda-forge/hdmf-feedstock/pulls>`_.
259 After the tests pass, merge the PR, and a new release will be published on Anaconda cloud.