raver.cli#

Module Contents#

Classes#

RaverContext

Raver context object.

Functions#

cli(ctx, module, ref, config, changelog, debug, version)

Ratio versioning checker.

configdict(→ collections.defaultdict)

Recursive defaultdict.

error(message[, exitcode])

Print to stderr in red and exit with 1.

warn(message)

Print to stderr in yellow but do not exit, yet.

debug(message)

Only print debug messages if debug mode is set.

resolve_module_path(→ pathlib.Path)

Resolve a Python module to it's file Path.

get_module_version(→ semver.VersionInfo)

Get module version from it's text.

capture(→ str)

Run command and return decoded and stripped output.

resolve_git_path(→ pathlib.Path)

Resolve provided path relative to this git directory's root.

get_current_ref(→ Optional[str])

Get current git reference.

fetch_git_ref(ref)

get_ref_text(→ str)

has_ref_changes(→ bool)

check_ref_increments(→ bool)

Check whether version has been properly incremented versus the git reference.

check_changelog(→ bool)

Check whether semantic version exists in changelog path.

Attributes#

VERSION

info

success

raver.cli.VERSION#
raver.cli.cli(ctx: click.Context, module: pathlib.Path | None, ref: str | None, config: pathlib.Path | None, changelog: pathlib.Path | None, debug: bool, version: bool)#

Ratio versioning checker.

class raver.cli.RaverContext(module: pathlib.Path | None, ref: str | None, config: pathlib.Path | None, changelog: pathlib.Path | None, debug: bool, version: bool, success: bool = True)#

Raver context object.

TYPES#
parse()#

Parse with current settings.

parse_poetry_toml(cdict: collections.defaultdict)#

Parse the poetry section of a config dictionary.

parse_raver_toml(cdict: collections.defaultdict)#

Parse own TOML keys.

parse_section(cdict: Any, types: Dict[str, Any], section: str)#

Check a section on allowed keys and set config attributes.

parse_module()#

Parse module contents for version info.

parse_ref()#

Parse git ref for info.

report()#

Describe current status.

parse_changelog()#

Check if a changelog entry exists for the current version.

raver.cli.configdict(**kwargs) collections.defaultdict#

Recursive defaultdict.

raver.cli.info#
raver.cli.success#
raver.cli.error(message: str, exitcode: int = 1)#

Print to stderr in red and exit with 1.

raver.cli.warn(message: str)#

Print to stderr in yellow but do not exit, yet.

raver.cli.debug(message: str)#

Only print debug messages if debug mode is set.

raver.cli.resolve_module_path(module: pathlib.Path) pathlib.Path#

Resolve a Python module to it’s file Path.

raver.cli.get_module_version(text: str) semver.VersionInfo#

Get module version from it’s text.

raver.cli.capture(cmd: str, **kwargs) str#

Run command and return decoded and stripped output.

raver.cli.resolve_git_path(path: str | pathlib.Path) pathlib.Path#

Resolve provided path relative to this git directory’s root.

raver.cli.get_current_ref() str | None#

Get current git reference.

raver.cli.fetch_git_ref(ref: str)#
raver.cli.get_ref_text(path: str | pathlib.Path, ref: str = 'master') str#
raver.cli.has_ref_changes(ref: str) bool#
raver.cli.check_ref_increments(module_version: semver.VersionInfo, ref_version: semver.VersionInfo, changes: bool) bool#

Check whether version has been properly incremented versus the git reference.

raver.cli.check_changelog(changelog: pathlib.Path, version: semver.VersionInfo) bool#

Check whether semantic version exists in changelog path.

Only checks for major.minor.patch, prereleases and builds are ignored.