Skip to content

Commit a941003

Browse files
authored
Release notes: 2 level of changelog (#5271)
1 parent 89f5f48 commit a941003

2 files changed

Lines changed: 119 additions & 32 deletions

File tree

dev/releases/release_notes.py

Lines changed: 68 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,8 @@ def warning(s):
8484
# the given label is put into the corresponding section; each PR is put into only one section, the first one
8585
# one from this list it fits in.
8686
# See also <https://github.com/gap-system/gap/issues/4257>.
87-
prioritylist = [
88-
["release notes: highlight", "Highlights"],
89-
90-
["renaming", "Renamings"],
91-
87+
topics = [
88+
["release notes: highlight", "Highlights"],
9289
["topic: algebraic geometry", "Algebraic Geometry"],
9390
["topic: combinatorics", "Combinatorics"],
9491
["topic: commutative algebra", "Commutative Algebra"],
@@ -99,24 +96,25 @@ def warning(s):
9996
["topic: polyhedral geometry", "Polyhedral Geometry"],
10097
["topic: toric geometry", "Toric Geometry"],
10198
["topic: tropical geometry", "Tropical Geometry"],
102-
103-
["serialization", "Changes related to serializing data in the MRDI file format"],
104-
105-
["enhancement", "New features or extended functionality"],
106-
["experimental", "Only changes experimental parts of OSCAR"],
107-
["optimization", "Performance improvements or improved testing"],
108-
["bug: crash", "Fixed bugs that could lead to crashes"],
109-
["bug", "Other fixed bugs"],
110-
["documentation", "Improvements or additions to documentation"],
111-
11299
["package: AbstractAlgebra", "Changes related to the package AbstractAlgebra"],
113100
["package: AlgebraicSolving", "Changes related to the package AlgebraicSolving"],
114101
["package: GAP", "Changes related to the package GAP"],
115102
["package: Hecke", "Changes related to the package Hecke"],
116103
["package: Nemo", "Changes related to the package Nemo"],
117104
["package: Polymake", "Changes related to the package Polymake"],
118105
["package: Singular", "Changes related to the package Singular"],
119-
106+
]
107+
prtypes = [
108+
["renaming", "Renamings"],
109+
["serialization", "Changes related to serializing data in the MRDI file format"],
110+
["enhancement", "New features or extended functionality"],
111+
["experimental", "Only changes experimental parts of OSCAR"],
112+
["optimization", "Performance improvements or improved testing"],
113+
["bug: wrong result", "Fixed bugs that returned incorrect results"],
114+
["bug: crash", "Fixed bugs that could lead to crashes"],
115+
["bug: unexpected error", "Fixed bugs that resulted in unexpected errors"],
116+
["bug", "Other fixed bugs"],
117+
["documentation", "Improvements or additions to documentation"],
120118
]
121119

122120

@@ -209,28 +207,57 @@ def changes_overview(
209207
totalPRs = len(prs)
210208
print(f"Total number of PRs: {totalPRs}")
211209
countedPRs = 0
212-
for priorityobject in prioritylist:
210+
for priorityobject in topics:
213211
matches = [
214212
pr for pr in prs_with_use_title if has_label(pr, priorityobject[0])
215213
]
216214
print("PRs with label '" + priorityobject[0] + "': ", len(matches))
215+
print(matches)
217216
countedPRs = countedPRs + len(matches)
218217
if len(matches) == 0:
219218
continue
220219
relnotes_file.write("### " + priorityobject[1] + "\n\n")
221-
for pr in matches:
222-
relnotes_file.write(pr_to_md(pr))
223-
prs_with_use_title.remove(pr)
224-
relnotes_file.write("\n")
220+
if priorityobject[1] == 'Highlights':
221+
itervar = topics
222+
else:
223+
itervar = prtypes
224+
for typeobject in itervar:
225+
if typeobject[1] == priorityobject[1]:
226+
continue
227+
matches_type = [
228+
pr for pr in matches if has_label(pr, typeobject[0])
229+
]
230+
print("PRs with label '" + priorityobject[0] + "' and type '" + typeobject[0] + "': ", len(matches_type))
231+
if len(matches_type) == 0:
232+
continue
233+
relnotes_file.write(f"#### {typeobject[1]}\n\n")
234+
for pr in matches_type:
235+
relnotes_file.write(pr_to_md(pr))
236+
prs_with_use_title.remove(pr)
237+
matches.remove(pr)
238+
matches_type.remove(pr)
239+
relnotes_file.write('\n')
225240
print(f"Remaining PRs: {totalPRs - countedPRs}")
226241
# The remaining PRs have no "kind" or "topic" label from the priority list
227242
# (may have other "kind" or "topic" label outside the priority list).
228243
# Check their list in the release notes, and adjust labels if appropriate.
229244
if len(prs_with_use_title) > 0:
230245
relnotes_file.write("### Other changes\n\n")
231-
for pr in prs_with_use_title:
232-
relnotes_file.write(pr_to_md(pr))
233-
relnotes_file.write("\n")
246+
for typeobject in prtypes:
247+
print(typeobject)
248+
matches_type = [
249+
pr for pr in prs_with_use_title if has_label(pr, typeobject[0])
250+
]
251+
len(matches_type)
252+
print("PRs with label '" + priorityobject[0] + "' and type '" + typeobject[0] + "': ", len(matches_type))
253+
if len(matches_type) == 0:
254+
continue
255+
relnotes_file.write("#### " + typeobject[1] + "\n\n")
256+
257+
for pr in matches_type:
258+
relnotes_file.write(pr_to_md(pr))
259+
prs_with_use_title.remove(pr)
260+
relnotes_file.write("\n")
234261

235262
# Report PRs that have to be updated before inclusion into release notes.
236263
prs_to_be_added = [pr for pr in prs if has_label(pr, "release notes: to be added")]
@@ -245,6 +272,23 @@ def changes_overview(
245272
for pr in prs_to_be_added:
246273
relnotes_file.write(pr_to_md(pr))
247274
relnotes_file.write("\n")
275+
if len(prs_with_use_title) > 0:
276+
relnotes_file.write(
277+
"### **TODO** insufficient labels for automatic classification\n\n"
278+
"The following PRs only have a topic label assigned to them, not a PR type. Either "
279+
"assign a type label to them (e.g., `enhancement`), or manually move them to the "
280+
"general section of the topic section in the changelog.\n\n")
281+
for pr in prs_with_use_title:
282+
for topic in topics:
283+
matches = [pr for pr in prs_with_use_title if has_label(pr, topic[0])]
284+
if len(matches) == 0:
285+
continue
286+
relnotes_file.write(f'#### {topic[1]}\n\n')
287+
for match in matches:
288+
relnotes_file.write(pr_to_md(match))
289+
prs_with_use_title.remove(match)
290+
relnotes_file.write('\n')
291+
relnotes_file.write('\n')
248292

249293
# remove PRs already handled earlier
250294
prs = [pr for pr in prs if not has_label(pr, "release notes: to be added")]

docs/src/DeveloperDocumentation/changelog.md

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ labelled. We have the following labels, along with how they are meant to be appl
6060
In addition to the release notes action labels, you can tag your PR with these following
6161
labels, and the release notes script will organize them appropriately:
6262

63+
#### Multi level topics
64+
65+
The changelog is organized into a 2 level structure: the topic, and the type. Each PR must have one
66+
topic label, and one type label. The changes in each topic are then grouped by types, before moving
67+
on to the next topic, which are also grouped by types, and so on.
68+
69+
##### PR Topics
70+
6371
| Label | Changelog Category |
6472
|-------------------------------|--------------------|
6573
| `release notes: highlight` | Highlights |
66-
| `renaming` | Items being renamed |
6774
| `topic: algebraic geometry` | Changes related to Algebraic Geometry |
6875
| `topic: combinatorics` | Changes related to Combinatorics |
6976
| `topic: commutative algebra` | Changes related to Commutative Algebra |
@@ -74,13 +81,6 @@ labels, and the release notes script will organize them appropriately:
7481
| `topic: polyhedral geometry` | Changes related to Polyhedral Geometry |
7582
| `topic: toric geometry ` | Changes related to Toric Geometry |
7683
| `topic: tropical geometry` | Changes related to Tropical Geometry |
77-
| `serialization` | Changes related to serializing data in the MRDI file format ? |
78-
| `enhancement` | New features or extended functionality |
79-
| `experimental` | Only changes experimental parts of OSCAR |
80-
| `optimization` | Performance improvements or improved testing |
81-
| `bug: crash` | Fixed bugs that could lead to crashes |
82-
| `bug` | Other fixed bugs |
83-
| `documentation` | Improvements or additions to documentation |
8484
| `package: AbstractAlgebra` | Changes related to the package AbstractAlgebra |
8585
| `package: AlgebraicSolving` | Changes related to the package AlgebraicSolving |
8686
| `package: GAP` | Changes related to the package GAP |
@@ -89,6 +89,49 @@ labels, and the release notes script will organize them appropriately:
8989
| `package: Polymake` | Changes related to the package Polymake |
9090
| `package: Singular` | Changes related to the package Singular |
9191

92+
##### PR Types
93+
94+
| Label | Changelog Category |
95+
|-------------------------------|--------------------|
96+
| `renaming` | Items being renamed |
97+
| `serialization` | Changes related to serializing data in the MRDI file format |
98+
| `enhancement` | New features or extended functionality |
99+
| `experimental` | Only changes experimental parts of OSCAR |
100+
| `optimization` | Performance improvements or improved testing |
101+
| `bug: wrong result` | Fixed bugs that returned incorrect results |
102+
| `bug: crash` | Fixed bugs that could lead to crashes |
103+
| `bug: unexpected error` | Fixed bugs that resulted in unexpected errors |
104+
| `bug` | Other fixed bugs |
105+
| `documentation` | Improvements or additions to documentation |
106+
107+
#### Example
108+
109+
As an example, the following PRs are rendered as follows:
110+
111+
> - PR #1337 with topic label `topic: groups`, and type label `optimization`
112+
> - PR #1338 with topic label `package: Singular`, and type label `renaming`
113+
> - PR #1339 with topic label `package: Singular`, and type label `experimental`
114+
115+
-----
116+
>
117+
> ### Groups
118+
>
119+
> #### Performance improvements or improved testing
120+
>
121+
> - [#1337] Lorem ipsum
122+
>
123+
> ### Changes related to the package Singular
124+
>
125+
> #### Renamings
126+
>
127+
> - [#1338] Foo bar
128+
>
129+
> #### Only changes experimental parts of OSCAR
130+
>
131+
> - [#1338] Alice bob
132+
>
133+
-----
134+
92135
## Suggestions for formulations
93136

94137
In general the description of each change should start with a verb in present

0 commit comments

Comments
 (0)