Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# semantic_release.cli.util module

Utilities for command-line functionality

semantic_release.cli.util.indented(msg: str, prefix: str = ' ') → str

  Convenience function for text-formatting for the console.

  Ensures the least indented line of the msg string is indented by `prefix` with consistent alignment of the remainder of `msg` irrespective of the level of indentation in the Python source code

semantic_release.cli.util.load_raw_config_file(config_file: Path | str) → dict[Any, Any]

  Load raw configuration as a dict from the filename specified by config_filename, trying the following parsing methods:

  1. try to parse with tomli.load (guessing it’s a TOML file)

  2. try to parse with json.load (guessing it’s a JSON file)

  3. raise InvalidConfiguration if none of the above parsing methods work

  This function will also raise FileNotFoundError if it is raised while trying to read the specified configuration file

semantic_release.cli.util.noop_report(msg: str) → None

  Rich-prints a msg with a standard prefix to report when an action is not being taken due to a “noop” flag

semantic_release.cli.util.parse_toml(raw_text: str) → dict[Any, Any]

  Attempts to parse raw configuration for semantic_release using tomlkit.loads, raising InvalidConfiguration if the TOML is invalid or there’s no top level “semantic_release” or “tool.semantic_release” keys

semantic_release.cli.util.rprint(msg: str) → None

  Rich-prints to stderr so that redirection of command output isn’t cluttered