Skip to content

Commit 16c24f1

Browse files
GlenNichollsumarcor
andcommitted
docs: improve changelog to be automatically generated by towncrier
Co-Authored-By: Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
1 parent 655ca90 commit 16c24f1

7 files changed

Lines changed: 111 additions & 27 deletions

File tree

docs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/_build/
22
/*.inc
33
/license.rst
4-
/release_notes.rst

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
language = "en"
5353

54-
exclude_patterns = ["release_notes/*.*"]
54+
exclude_patterns = ["release_notes/*.*", "news.d/*.*"]
5555

5656
todo_include_todos = False
5757

docs/contributing.rst

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,26 +189,38 @@ A full list of test environments can be seen by issuing the following command:
189189
Making releases
190190
~~~~~~~~~~~~~~~
191191

192+
.. IMPORTANT::
193+
Reference :ref:`release_notes_instructions` for creating relevant news fragments that will be added to the :ref:`release_notes`.
194+
192195
Releases are automatically made by GitHub Actions on any ``master`` commit which is tagged.
193196

194197
To create a new tagged release commit:
195198

196-
- Create corresponding release notes in ``docs/release_notes/X.Y.Z.rst``.
197-
- The release notes files in ``docs/release_notes/`` are used to
198-
automatically generate the :ref:`release notes <release_notes>`.
199+
- Build the docs and review the content of ``docs/news.inc``.
200+
201+
- If necessary, create additional news files and build the docs again.
202+
203+
- Add the news summary as the release notes and remove news fragments:
204+
205+
.. code-block::python
206+
207+
mv docs/news.inc docs/release_notes/X.Y.Z.rst
208+
git add docs/release_notes/X.Y.Z.rst
209+
git rm -f docs/news.d/*.rst
210+
199211
- Execute ``python tools/release.py create X.Y.Z``.
200-
- Will make commit with the new ``about.py`` version and release notes and tag it.
201-
- Will make another commit setting ``about.py`` to the next pre release candidate version.
212+
- Will make and tag a commit with the new ``about.py`` version, the release notes and removed news files.
213+
- Will make another commit setting ``about.py`` to the next development version.
214+
202215
- Push the tag to remote to trigger the release build.
203-
- ``git push origin vX.Y.Z``
204-
- If the release build is successful, you can push the two commits to master.
205-
- ``git push origin master``
206-
- If, in the meantime, a new commit has come into origin/master the two
207-
commits have to be merged into origin/master.
216+
- ``git push origin vX.Y.Z``
208217

218+
- If the release build is successful, you can push the two commits to master.
219+
- ``git push origin master``
220+
- If, in the meantime, a new commit has come into origin/master the two commits have to be merged into origin/master.
209221

210-
The CI service makes a release by uploading a new package to PyPI when a tag
211-
named ``vX.Y.Z`` is found in Git. A new release will not be made if:
222+
The CI service makes a release by uploading a new package to PyPI when a tag named ``vX.Y.Z`` is found in Git.
223+
A new release will not be made if:
212224

213225
- The ``X.Y.Z`` release is already on PyPI.
214226
- The repo tag does not exist.
@@ -222,3 +234,31 @@ Therefore, when bumping the submodules, maintainers/contributors need to remembe
222234
version.
223235

224236
Furthermore, since OSVVM is tagged periodically, bumping from tag to tag is strongly suggested.
237+
238+
.. _release_notes_instructions:
239+
240+
Release Notes Instructions
241+
--------------------------
242+
243+
The :vunit_file:`release notes directory <docs/news.d>` contains "newsfragments" which
244+
are short (`reST formatted
245+
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_) files that
246+
contain information for users.
247+
248+
Make sure to use full sentences in the **past or present tense** and use punctuation.
249+
250+
Each file should be named like ``<issue #>.<type>.rst``, where ``<issue #>`` is the
251+
GitHub issue or pull request number, and ``<type>`` is one of:
252+
253+
* ``breaking``: a change which may break existing functionality, such as feature removal
254+
or behavior change
255+
* ``bugfix``: fixes a bug
256+
* ``change``: backwards compatible features or improvements
257+
* ``deprecation``: feature deprecation
258+
* ``misc``: a ticket was closed, but it is not necessarily important for the user
259+
260+
For example: ``123.feature.rst``, ``456.bugfix.rst``.
261+
262+
``towncrier`` preserves multiple paragraphs and formatting
263+
(code blocks, lists, and so on), but for entries other than features, it is usually
264+
better to stick to a single paragraph to keep it concise.

docs/news.d/.gitkeep

Whitespace-only changes.

docs/release_notes.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.. _release_notes:
2+
3+
Release notes
4+
=============
5+
6+
.. NOTE:: For installation instructions read :ref:`this <installing>`.
7+
8+
:vunit_commit:`Next <master>`
9+
-----------------------------
10+
11+
.. include:: news.inc
12+
13+
.. include:: release_notes.inc

pyproject.toml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,44 @@ build-backend = "setuptools.build_meta"
88
[tool.black]
99
line-length = 120
1010

11+
[tool.towncrier]
12+
package = "vunit"
13+
package_dir = "vunit"
14+
single_file = false
15+
filename="docs/news.inc"
16+
directory = "docs/news.d/"
17+
title_format = false
18+
issue_format = ":vunit_issue:`{issue}`"
19+
underlines = ["-", "~"]
20+
21+
[[tool.towncrier.section]]
22+
path = ""
23+
24+
[[tool.towncrier.type]]
25+
directory = "breaking"
26+
name = "Breaking Changes"
27+
showcontent = true
28+
29+
[[tool.towncrier.type]]
30+
directory = "bugfix"
31+
name = "Bug Fixes"
32+
showcontent = true
33+
34+
[[tool.towncrier.type]]
35+
directory = "change"
36+
name = "Changes"
37+
showcontent = true
38+
39+
[[tool.towncrier.type]]
40+
directory = "deprecation"
41+
name = "Deprecations"
42+
showcontent = true
43+
44+
[[tool.towncrier.type]]
45+
directory = "misc"
46+
name = "Miscellaneous"
47+
showcontent = true
48+
1149
[tool.tox]
1250
legacy_tox_ini = """
1351
[tox]
@@ -34,6 +72,7 @@ deps=
3472
docs: furo
3573
docs: sphinx
3674
docs: sphinx-argparse
75+
docs: towncrier
3776
3877
setenv=
3978
acceptance-activehdl: VUNIT_SIMULATOR=activehdl

tools/create_release_notes.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pathlib import Path
1212
from os.path import relpath
1313
from glob import glob
14-
from subprocess import check_output, CalledProcessError
14+
from subprocess import check_call, check_output, CalledProcessError
1515
from shutil import which
1616
import datetime
1717

@@ -33,22 +33,15 @@ def create_release_notes():
3333
"""
3434
source_path = Path(__file__).parent.parent / "docs"
3535

36+
check_call(["towncrier", "build", "--keep"], cwd=source_path.parent)
37+
3638
releases = get_releases(source_path)
3739
latest_release = releases[0]
3840

39-
with (source_path / "release_notes.rst").open("w", encoding="utf-8") as fptr:
41+
with (source_path / "release_notes.inc").open("w", encoding="utf-8") as fptr:
4042
fptr.write(
41-
f"""
42-
.. _release_notes:
43-
44-
Release notes
45-
=============
46-
47-
.. NOTE:: For installation instructions read :ref:`this <installing>`.
48-
49-
`Commits since last release <https://github.com/VUnit/vunit/compare/{latest_release.tag!s}...master>`__
50-
51-
"""
43+
"`Commits since last release "
44+
f"<https://github.com/VUnit/vunit/compare/{latest_release.tag!s}...master>`__"
5245
)
5346

5447
fptr.write("\n\n")

0 commit comments

Comments
 (0)