rlsbl v0.92.0 /rlsbl.release_file
On this page

Release file reader and validator: parses unreleased.toml for bump type and targets, batch release TOML for monorepos, and retry.toml via RetryConfig.

#rlsbl.release_file

#rlsbl.release_file

Release file reader and validator for file-based releases.

Instead of passing bump type on the CLI, the user creates .rlsbl/releases/unreleased.toml describing the release. This module reads and validates that file's internal consistency.

#ReleaseConfig

ReleaseConfig
FieldTypeDefault
bumpstr
includelist[str]
excludelist[str]
targetsdict[str, dict]field(default_factory=dict)
descriptionstr''
contextstr''
preidstr''
blogboolFalse

#get_release_file_path

python
def get_release_file_path(project_dir: str='.') -> str

Return the path to .rlsbl/releases/unreleased.toml relative to project_dir.

#_validate_release_config

python
def _validate_release_config(data: dict, prefix: str='') -> ReleaseConfig

Validate release config fields from a parsed TOML dict.

Shared validation for both single-project and batch (per-package) release configs. The prefix is prepended to all error messages -- empty string for single-project, "[packages.] " for batch.

Raises ReleaseFileError for schema/validation failures. Returns a ReleaseConfig on success.

#read_release_file

python
def read_release_file(path: str) -> ReleaseConfig

Read and validate a release TOML file.

Raises FileNotFoundError if the file doesn't exist. Raises ReleaseFileError for schema/validation failures.

#unfinalize_release_file

python
def unfinalize_release_file(releases_dir: str, version: str) -> list[str]

Reverse a release-file finalization: restore vX.Y.Z.toml to unreleased.toml.

Inverse of the finalization step in release run, which renames unreleased.toml to vX.Y.Z.toml and chmods it read-only (0o444).

  1. No-op (returns []) if the versioned file doesn't exist.
  2. If unreleased.toml exists with content that differs from the versioned

file, warns on stderr and skips -- nothing is deleted.

  1. Otherwise removes any stale unreleased.toml, makes the versioned file

writable, and renames it back to unreleased.toml.

Returns the list of changed file paths (for committing).

#BatchReleaseConfig

Configuration from a batch release TOML file (monorepo).

packages maps either package names (implicit mode / backward compat) or releasable names (explicit mode) to their release configs. section_type indicates which top-level key was used: "packages" or "releasables".

#get_batch_release_file_path

python
def get_batch_release_file_path(workspace_root: str='.') -> str

Return the path to .rlsbl-monorepo/releases/unreleased.toml.

#read_batch_release_file

python
def read_batch_release_file(path: str) -> BatchReleaseConfig

Read and validate a batch release TOML file.

Accepts either [packages.] sections (implicit mode, backward compat) or [releasables.] sections (explicit mode). Having both is a hard error.

Each section has the same fields as a single ReleaseConfig (bump, include, exclude, optional targets, description, context).

Raises FileNotFoundError if the file doesn't exist. Raises ReleaseFileError for schema/validation failures.

#RetryConfig

Configuration from a retry TOML file (.rlsbl/releases/retry.toml).

#get_retry_file_path

python
def get_retry_file_path(project_dir: str='.') -> str

Return the path to .rlsbl/releases/retry.toml relative to project_dir.

#read_retry_file

python
def read_retry_file(path: str) -> RetryConfig

Read and validate a retry TOML file.

Raises FileNotFoundError if the file doesn't exist. Raises ReleaseFileError for schema/validation failures.