API Reference

This section provides detailed documentation for the Python Release Master API.

AI Module

python_release_master.core.ai.generate_changelog_with_ai(sections: List[str], model: str = 'gpt-4-0125-preview') Dict[str, Any][source]

Generate a changelog using OpenAI with structured output.

Parameters:
  • sections – List of section names to organize changes (e.g., [“Features”, “Bug Fixes”])

  • model – OpenAI model to use (default: “gpt-4-0125-preview”)

Returns:

Dictionary containing changelog data with the following structure:

{
    "version_bump": "major|minor|patch",
    "bump_reason": "explanation of why this bump type was chosen",
    "changes": [
        {
            "title": "commit/PR title",
            "description": "detailed description",
            "section": "one of the available sections",
            "type": "feat|fix|docs|style|refactor|test|chore",
            "breaking": boolean
        }
    ],
    "changelog_md": "final markdown formatted changelog with sections"
}
python_release_master.core.ai.commit_changes_with_ai() str | None[source]

Generate commit message and commit changes using AI.

Returns:

The generated commit message if changes were committed, None otherwise.

python_release_master.core.ai.get_commits_since_last_tag() List[str][source]

Get all commit messages since the last tag.

Returns:

List of commit messages with their hashes.

python_release_master.core.ai.get_pull_requests_since_last_tag() List[dict][source]

Get all merged pull requests since the last tag.

Returns:

List of pull request data dictionaries.

Release Module

python_release_master.core.release.create_release(bump_type: str, title: str, description: str | None, config: Config, skip_steps: List[str] | None = None) None[source]

Create a new release.

Parameters:
  • bump_type – Type of version bump (“major”, “minor”, “patch”)

  • title – Release title

  • description – Optional release description

  • config – Release configuration

  • skip_steps – Optional list of steps to skip

python_release_master.core.release.bump_version(bump_type: str, version_files: List[str]) None[source]

Bump version in all specified files.

Parameters:
  • bump_type – Type of version bump (“major”, “minor”, “patch”)

  • version_files – List of files containing version strings

Configuration

class python_release_master.core.config.Config[source]

Main configuration for Python Release Master.

version_files: List[str]

List of files containing version strings.

changelog: ChangelogConfig

Configuration for changelog generation.

skip_steps: List[str]

List of steps to skip during release.

class python_release_master.core.config.ChangelogConfig[source]

Configuration for changelog generation.

ai_powered: bool

Whether to use AI-powered changelog generation.

openai_model: str

OpenAI model to use for generation.

sections: List[str]

List of sections to organize changes.