Skip to content

Commit b4d139f

Browse files
committed
Add missing script
1 parent 82c9a43 commit b4d139f

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""
2+
Extract the changes from the latest version in our CHANGELOG
3+
4+
These can then be used in our release template.
5+
"""
6+
7+
from __future__ import annotations
8+
9+
from pathlib import Path
10+
11+
import typer
12+
13+
14+
def main() -> None:
15+
"""
16+
Extract the latest version changes from our CHANGELOG
17+
18+
They are printed to stdout
19+
"""
20+
CHANGELOG = Path("docs") / "changelog.md"
21+
22+
with open(CHANGELOG) as fh:
23+
changelog_raw = fh.read()
24+
25+
check_for_next_version = False
26+
grab_notes = False
27+
latest_version_notes: list[str] = []
28+
for line in changelog_raw.splitlines():
29+
if not check_for_next_version:
30+
if line == "<!-- towncrier release notes start -->":
31+
check_for_next_version = True
32+
33+
continue
34+
35+
if not grab_notes:
36+
if line.startswith("## mkdocstrings-python-accessors"):
37+
grab_notes = True
38+
39+
continue
40+
41+
# We are grabbing notes now
42+
# If we've reached the next version's notes, break
43+
if line.startswith("## mkdocstrings-python-accessors"):
44+
break
45+
46+
latest_version_notes.append(line)
47+
48+
print("\n".join(latest_version_notes))
49+
50+
51+
if __name__ == "__main__":
52+
typer.run(main)

0 commit comments

Comments
 (0)