mafw.devtools.release.changelog

Changelog generation and parsing utilities for MAFw releases.

This module contains the business logic for generating the project changelog and extracting version-specific change sections from it.

Module Attributes

CHANGELOG_FILE

Path to the changelog file that is regenerated for each release.

RELEASE_SECTION_HEADERS

Release note section headers used in the markdown template.

Functions

extract_change_sections_from_changelog(version)

Extract release change sections from CHANGELOG.md.

extract_change_sections_from_changelog_block(...)

Extract release change sections from a changelog block.

extract_version_changelog_block(...)

Extract the changelog block associated with the target version.

generate_changelog(version, dry_run)

Generate the project changelog for the target release.

mafw.devtools.release.changelog._classify_changelog_subsection(subsection_heading: str) str | None[source]

Map a changelog subsection heading to a release-note category key.

Parameters:

subsection_heading (str) – Raw level-3 heading from changelog.

Returns:

Category key, or None if the heading is not mappable.

Return type:

str | None

mafw.devtools.release.changelog.extract_change_sections_from_changelog(version: str) dict[str, str][source]

Extract release change sections from CHANGELOG.md.

Parameters:

version (str) – Target release version without leading v.

Returns:

Mapping from release-note category key to markdown content.

Return type:

dict[str, str]

Raises:

DevtoolsError – If changelog file does not exist or the requested section is missing.

mafw.devtools.release.changelog.extract_change_sections_from_changelog_block(changelog_block: str) dict[str, str][source]

Extract release change sections from a changelog block.

The parsing logic expects the block to contain level-3 headings (###) with standardized labels (e.g. “New Features”, “Bug Fixes”, …).

Parameters:

changelog_block (str) – Changelog markdown block to parse.

Returns:

Mapping from release-note category key to markdown content.

Return type:

dict[str, str]

mafw.devtools.release.changelog.extract_version_changelog_block(changelog_content: str, version: str) str[source]

Extract the changelog block associated with the target version.

Parameters:
  • changelog_content (str) – Complete changelog markdown text.

  • version (str) – Target release version without leading v.

Returns:

Markdown block for the selected release.

Return type:

str

Raises:

DevtoolsError – If no section for the target version is found.

mafw.devtools.release.changelog.generate_changelog(version: str, dry_run: bool) None[source]

Generate the project changelog for the target release.

Parameters:
  • version (str) – Target release version.

  • dry_run (bool) – Whether command execution is disabled.

mafw.devtools.release.changelog.CHANGELOG_FILE = PosixPath('CHANGELOG.md')

Path to the changelog file that is regenerated for each release.

mafw.devtools.release.changelog.RELEASE_SECTION_HEADERS = {'bug_fixes': '## 🐛 Bug Fixes', 'deprecated': '## ⚠️ Deprecated', 'new_features': '## 🚀 New Features', 'other_changes': '## ️*️⃣    Other Changes', 'refactorings': '## ♻️ Refactorings', 'removed': '## 🗑️ Removals', 'security': '## 🔒 Security'}

Release note section headers used in the markdown template.