2 from __future__
import annotations
8 from rich.syntax
import Syntax
12 Suggested \s changelog \s entry:
20 re.DOTALL | re.VERBOSE,
26 api = ghapi.all.GhApi(owner=
"pybind", repo=
"pybind11")
28 issues_pages = ghapi.page.paged(
29 api.issues.list_for_repo, labels=
"needs changelog", state=
"closed"
31 issues = (issue
for page
in issues_pages
for issue
in page)
34 "feat":
"New Features",
40 "docs":
"Documentation",
44 "unknown":
"Uncategorised",
46 cats: dict[str, list[str]] = {c: []
for c
in cats_descr}
49 changelog = ENTRY.findall(issue.body
or "")
50 if not changelog
or not changelog[0]:
54 if msg.startswith(
"- "):
56 if not msg.startswith(
"* "):
58 if not msg.endswith(
"."):
61 msg += f
"\n `#{issue.number} <{issue.html_url}>`_"
63 if issue.title.lower().startswith(f
"{cat}:"):
67 cats[
"unknown"].append(msg)
69 for cat, msgs
in cats.items():
71 desc = cats_descr[cat]
72 print(f
"[bold]{desc}:" if desc
else f
".. {cat}")
75 print(Syntax(msg,
"rst", theme=
"ansi_light", word_wrap=
True))
81 print(
"[blue]" +
"-" * 30)
85 print(f
"[red bold]Missing:[/red bold][red] {issue.title}")
86 print(f
"[red] {issue.html_url}\n")
88 print(
"[bold]Template:\n")
89 msg =
"## Suggested changelog entry:\n\n```rst\n\n```"
90 print(Syntax(msg,
"md", theme=
"ansi_light"))