@@ -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" )]
0 commit comments