pontos.changelog package

exception pontos.changelog.ChangelogError

Bases: PontosError

Some error has occurred during changelog handling

exception pontos.changelog.ChangelogBuilderError

Bases: ChangelogError

An error while building a changelog

class pontos.changelog.ChangelogBuilder(*, repository, git_tag_prefix='v', config=None)

Creates Changelog from conventional commits using the git log from the latest version.

Example

Create a changelog as a string from the changes between git tags “v1.2.3” and “v2.0.0” using the default config settings.

from pontos.changelog import ChangelogBuilder

builder = ChangelogBuilder(repository="my-org/my-project)
changelog = builder.create_changelog(
    last_version="1.2.3",
    next_version="2.0.0",
)

Create a new ChangelogBuilder instance.

Parameters:
  • repository (str) – GitHub repository (owner/name) to create the changelog for. For example: “octocat/Hello-World”

  • git_tag_prefix (str | None) – Git tag prefix to use when checking for git tags. Default is “v”.

  • config (Path | None) – TOML config for conventional commit parsing settings

create_changelog(*, last_version=None, next_version=None)

Create a changelog

Parameters:
  • last_version (SupportsStr | None) – Version of the last release. If None it is considered as the first release.

  • next_version (SupportsStr | None) – Version of the to be created release the changelog corresponds to. If None a changelog for an unrelease version will be created.

Returns:

The created changelog content.

Return type:

str

create_changelog_file(output, *, last_version=None, next_version=None)

Create a changelog and write the changelog to a file

Parameters:
  • output (str | Path) – A file path where to store the changelog

  • last_version (SupportsStr | None) – Version of the last release. If None it is considered as the first release.

  • next_version (SupportsStr | None) – Version of the to be created release the changelog corresponds to. If None a changelog for an unrelease version will be created.