stouputils.continuous_delivery.pyproject module

Utilities for reading, writing and managing pyproject.toml files.

This module provides functions to handle pyproject.toml files, including reading, writing, version management and TOML formatting capabilities.

  • read_pyproject: Read the pyproject.toml file.

  • write_pyproject: Write to the pyproject.toml file.

  • format_toml_lists: Format TOML lists with proper indentation.

  • increment_version_from_input: Increment the patch version number.

  • increment_version_from_pyproject: Increment version in pyproject.toml.

  • get_version_from_pyproject: Get version from pyproject.toml.

stouputils pyproject examples
read_pyproject(pyproject_path: str) dict[str, Any][source]

Read the pyproject.toml file.

Parameters:

pyproject_path – Path to the pyproject.toml file.

Returns:

The content of the pyproject.toml file.

Return type:

dict[str, Any]

format_toml_lists(content: str) str[source]

Format TOML lists with indentation.

Parameters:

content (str) – The content of the pyproject.toml file.

Returns:

The formatted content with properly indented lists.

Return type:

str

write_pyproject(pyproject_path: str, pyproject_content: dict[str, Any]) None[source]

Write to the pyproject.toml file with properly indented lists.

increment_version_from_input(version: str) str[source]

Increment the version.

Parameters:

version – The version to increment. (ex: “0.1.0”)

Returns:

The incremented version. (ex: “0.1.1”)

Return type:

str

increment_version_from_pyproject(pyproject_path: str) None[source]

Increment the version in the pyproject.toml file.

Parameters:

pyproject_path – Path to the pyproject.toml file.

get_version_from_pyproject(pyproject_path: str) str[source]

Get the version from the pyproject.toml file.

Parameters:

pyproject_path – Path to the pyproject.toml file.

Returns:

The version. (ex: “0.1.0”)

Return type:

str