Skip to content

API Reference

Formatters

The SPDXMarkdown formatter extends commitizen's built-in Markdown changelog format with YAML frontmatter awareness. It strips ----delimited SPDX headers before parsing, so license identifiers like Apache-2.0 are never mistaken for version numbers.

Use this formatter when your changelog includes an SPDX/REUSE header block — set changelog_format = "spdx-markdown" in your project configuration.

Usage example

Configure commitizen in pyproject.toml:

[tool.commitizen]
changelog_format = "spdx-markdown"

Then generate your changelog:

cz bump --changelog

SPDXMarkdown

Bases: Markdown

Markdown changelog format with YAML frontmatter awareness.

Overrides two methods from :class:commitizen.changelog_formats.markdown.Markdown:

  • get_metadata() — strips frontmatter via :func:_strip_frontmatter, delegates to get_metadata_from_file(), then shifts the returned line indices by the frontmatter line count.
  • get_latest_full_release() — same stripping and index shift applied to get_latest_full_release_from_file().

Attributes:

Name Type Description
config

The commitizen configuration object.

get_latest_full_release(filepath)

Retrieve the latest full release info with frontmatter offset correction.

Parameters:

Name Type Description Default
filepath str

Path to the changelog file.

required

Returns:

Name Type Description
An IncrementalMergeInfo

class:commitizen.changelog.IncrementalMergeInfo with the

IncrementalMergeInfo

release index adjusted for stripped YAML frontmatter.

get_metadata(filepath)

Extract changelog metadata with frontmatter offset correction.

Parameters:

Name Type Description Default
filepath str

Path to the changelog file.

required

Returns:

Name Type Description
A Metadata

class:commitizen.changelog.Metadata instance with line

Metadata

indices adjusted for stripped YAML frontmatter.