Skip to content

Commit 1260724

Browse files
committed
💅 Introduce more accurate changelog categories
Specifically, the new Towncrier fragment types are set up to be `bugfix`, `feature`, `deprecation`, `breaking`, `doc`, `packaging`, `contrib`, `misc`. Previously, the `misc` fragments were rendered without the entry context, just as a list of PR numbers. With this change, the change note text is displayed as usual.
1 parent e5920de commit 1260724

33 files changed

+187
-25
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,35 @@
2121
- [ ] If you provide code modification, please add yourself to `CONTRIBUTORS.txt`
2222
* The format is <Name> <Surname>.
2323
* Please keep alphabetical order, the file is sorted by names.
24-
- [ ] Add a new news fragment into the `CHANGES` folder
25-
* name it `<issue_id>.<type>` for example (588.bugfix)
26-
* if you don't have an `issue_id` change it to the pr id after creating the pr
27-
* ensure type is one of the following:
28-
* `.feature`: Signifying a new feature.
29-
* `.bugfix`: Signifying a bug fix.
30-
* `.doc`: Signifying a documentation improvement.
31-
* `.removal`: Signifying a deprecation or removal of public API.
32-
* `.misc`: A ticket has been closed, but it is not of interest to users.
33-
* Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."
24+
- [ ] Add a new news fragment into the `CHANGES/` folder
25+
* name it `<issue_or_pr_num>.<type>.rst` (e.g. `588.bugfix.rst`)
26+
* if you don't have an issue number, change it to the pull request
27+
number after creating the PR
28+
* `.bugfix`: A bug fix for something the maintainers deemed an
29+
improper undesired behavior that got corrected to match
30+
pre-agreed expectations.
31+
* `.feature`: A new behavior, public APIs. That sort of stuff.
32+
* `.deprecation`: A declaration of future API removals and breaking
33+
changes in behavior.
34+
* `.breaking`: When something public is removed in a breaking way.
35+
Could be deprecated in an earlier release.
36+
* `.doc`: Notable updates to the documentation structure or build
37+
process.
38+
* `.packaging`: Notes for downstreams about unobvious side effects
39+
and tooling. Changes in the test invocation considerations and
40+
runtime assumptions.
41+
* `.contrib`: Stuff that affects the contributor experience. e.g.
42+
Running tests, building the docs, setting up the development
43+
environment.
44+
* `.misc`: Changes that are hard to assign to any of the above
45+
categories.
46+
* Make sure to use full sentences with correct case and punctuation,
47+
for example:
48+
```rst
49+
Fixed issue with non-ascii contents in doctest text files
50+
-- by :user:`contributor-gh-handle`.
51+
```
52+
53+
Use the past tense or the present tense a non-imperative mood,
54+
referring to what's changed compared to the last released version
55+
of this project.

.pre-commit-config.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ repos:
66
language: fail
77
entry: >-
88
Changelog files must be named
9-
####.(bugfix|feature|removal|doc|misc)(.#)?(.rst)?
9+
####.(
10+
bugfix
11+
| feature
12+
| deprecation
13+
| breaking
14+
| doc
15+
| packaging
16+
| contrib
17+
| misc
18+
)(.#)?(.rst)?
1019
exclude: >-
1120
(?x)
1221
^
@@ -15,8 +24,11 @@ repos:
1524
|(\d+|[0-9a-f]{8}|[0-9a-f]{7}|[0-9a-f]{40})\.(
1625
bugfix
1726
|feature
18-
|removal
27+
|deprecation
28+
|breaking
1929
|doc
30+
|packaging
31+
|contrib
2032
|misc
2133
)(\.\d+)?(\.rst)?
2234
|README\.rst

CHANGES/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1+
*
2+
!.TEMPLATE.rst
13
!.gitignore
4+
!README.rst
5+
!*.bugfix
6+
!*.bugfix.rst
7+
!*.bugfix.*.rst
8+
!*.breaking
9+
!*.breaking.rst
10+
!*.breaking.*.rst
11+
!*.contrib
12+
!*.contrib.rst
13+
!*.contrib.*.rst
14+
!*.deprecation
15+
!*.deprecation.rst
16+
!*.deprecation.*.rst
17+
!*.doc
18+
!*.doc.rst
19+
!*.doc.*.rst
20+
!*.feature
21+
!*.feature.rst
22+
!*.feature.*.rst
23+
!*.misc
24+
!*.misc.rst
25+
!*.misc.*.rst
26+
!*.packaging
27+
!*.packaging.rst
28+
!*.packaging.*.rst
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

CHANGES/README.rst

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,32 @@ with your own!).
4343
Finally, name your file following the convention that Towncrier
4444
understands: it should start with the number of an issue or a
4545
PR followed by a dot, then add a patch type, like ``feature``,
46-
``doc``, ``misc`` etc., and add ``.rst`` as a suffix. If you
46+
``doc``, ``contrib`` etc., and add ``.rst`` as a suffix. If you
4747
need to add more than one fragment, you may add an optional
4848
sequence number (delimited with another period) between the type
4949
and the suffix.
5050

5151
In general the name will follow ``<pr_number>.<category>.rst`` pattern,
5252
where the categories are:
5353

54-
- ``feature``: Any new feature
55-
- ``bugfix``: A bug fix
56-
- ``doc``: A change to the documentation
57-
- ``misc``: Changes internal to the repo like CI, test and build changes
58-
- ``removal``: For deprecations and removals of an existing feature or behavior
54+
- ``bugfix``: A bug fix for something we deemed an improper undesired
55+
behavior that got corrected in the release to match pre-agreed
56+
expectations.
57+
- ``feature``: A new behavior, public APIs. That sort of stuff.
58+
- ``deprecation``: A declaration of future API removals and breaking
59+
changes in behavior.
60+
- ``breaking``: When something public gets removed in a breaking way.
61+
Could be deprecated in an earlier release.
62+
- ``doc``: Notable updates to the documentation structure or build
63+
process.
64+
- ``packaging``: Notes for downstreams about unobvious side effects
65+
and tooling. Changes in the test invocation considerations and
66+
runtime assumptions.
67+
- ``contrib``: Stuff that affects the contributor experience. e.g.
68+
Running tests, building the docs, setting up the development
69+
environment.
70+
- ``misc``: Changes that are hard to assign to any of the above
71+
categories.
5972

6073
A pull request may have more than one of these components, for example
6174
a code change may introduce a new feature that deprecates an old

pyproject.toml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,67 @@ build-backend = "setuptools.build_meta"
1212
template = "CHANGES/.TEMPLATE.rst"
1313
issue_format = "{issue}"
1414

15+
# NOTE: The types are declared because:
16+
# NOTE: - there is no mechanism to override just the value of
17+
# NOTE: `tool.towncrier.type.misc.showcontent`;
18+
# NOTE: - and, we want to declare extra non-default types for
19+
# NOTE: clarity and flexibility.
20+
21+
[[tool.towncrier.section]]
22+
path = ""
23+
24+
[[tool.towncrier.type]]
25+
# Something we deemed an improper undesired behavior that got corrected
26+
# in the release to match pre-agreed expectations.
27+
directory = "bugfix"
28+
name = "Bug fixes"
29+
showcontent = true
30+
31+
[[tool.towncrier.type]]
32+
# New behaviors, public APIs. That sort of stuff.
33+
directory = "feature"
34+
name = "Features"
35+
showcontent = true
36+
37+
[[tool.towncrier.type]]
38+
# Declarations of future API removals and breaking changes in behavior.
39+
directory = "deprecation"
40+
name = "Deprecations (removal in next major release)"
41+
showcontent = true
42+
43+
[[tool.towncrier.type]]
44+
# When something public gets removed in a breaking way. Could be
45+
# deprecated in an earlier release.
46+
directory = "breaking"
47+
name = "Removals and backward incompatible breaking changes"
48+
showcontent = true
49+
50+
[[tool.towncrier.type]]
51+
# Notable updates to the documentation structure or build process.
52+
directory = "doc"
53+
name = "Improved documentation"
54+
showcontent = true
55+
56+
[[tool.towncrier.type]]
57+
# Notes for downstreams about unobvious side effects and tooling. Changes
58+
# in the test invocation considerations and runtime assumptions.
59+
directory = "packaging"
60+
name = "Packaging updates and notes for downstreams"
61+
showcontent = true
62+
63+
[[tool.towncrier.type]]
64+
# Stuff that affects the contributor experience. e.g. Running tests,
65+
# building the docs, setting up the development environment.
66+
directory = "contrib"
67+
name = "Contributor-facing changes"
68+
showcontent = true
69+
70+
[[tool.towncrier.type]]
71+
# Changes that are hard to assign to any of the above categories.
72+
directory = "misc"
73+
name = "Miscellaneous internal changes"
74+
showcontent = true
75+
1576

1677
[tool.cibuildwheel]
1778
test-command = ""

tools/check_changes.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@
44
import sys
55
from pathlib import Path
66

7-
ALLOWED_SUFFIXES = ["feature", "bugfix", "doc", "removal", "misc"]
8-
PATTERN = re.compile(r"\d+\.(" + "|".join(ALLOWED_SUFFIXES) + r")(\.\d+)?(\.rst)?")
7+
ALLOWED_SUFFIXES = (
8+
"bugfix",
9+
"feature",
10+
"deprecation",
11+
"breaking",
12+
"doc",
13+
"packaging",
14+
"contrib",
15+
"misc",
16+
)
17+
PATTERN = re.compile(
18+
r"(\d+|[0-9a-f]{8}|[0-9a-f]{7}|[0-9a-f]{40})\.("
19+
+ "|".join(ALLOWED_SUFFIXES)
20+
+ r")(\.\d+)?(\.rst)?",
21+
)
922

1023

1124
def get_root(script_path):

tools/cleanup_changes.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,21 @@
77
import subprocess
88
from pathlib import Path
99

10-
ALLOWED_SUFFIXES = ["feature", "bugfix", "doc", "removal", "misc"]
11-
PATTERN = re.compile(r"(\d+)\.(" + "|".join(ALLOWED_SUFFIXES) + r")(\.\d+)?(\.rst)?")
10+
ALLOWED_SUFFIXES = (
11+
"bugfix",
12+
"feature",
13+
"deprecation",
14+
"breaking",
15+
"doc",
16+
"packaging",
17+
"contrib",
18+
"misc",
19+
)
20+
PATTERN = re.compile(
21+
r"(\d+|[0-9a-f]{8}|[0-9a-f]{7}|[0-9a-f]{40})\.("
22+
+ "|".join(ALLOWED_SUFFIXES)
23+
+ r")(\.\d+)?(\.rst)?",
24+
)
1225

1326

1427
def main():
@@ -18,9 +31,10 @@ def main():
1831
for fname in (root / "CHANGES").iterdir():
1932
match = PATTERN.match(fname.name)
2033
if match is not None:
21-
num = match.group(1)
22-
tst = f"`#{num} <https://github.com/aio-libs/aiohttp/issues/{num}>`_"
23-
if tst in changes:
34+
commit_issue_or_pr = match.group(1)
35+
tst_issue_or_pr = f":issue:`{commit_issue_or_pr}`"
36+
tst_commit = f":commit:`{commit_issue_or_pr}`"
37+
if tst_issue_or_pr in changes or tst_commit in changes:
2438
subprocess.run(["git", "rm", fname])
2539
delete.append(fname.name)
2640
print("Deleted CHANGES records:", " ".join(delete))

0 commit comments

Comments
 (0)