Skip to content

hooks

Implementation of the hook interface.

Classes

Functions:

base_env

base_env(config: Config) -> Dict[str, str]

Provide the base environment variables.

get_post_commit_hook_env

get_post_commit_hook_env(config: Config, current_version: Version, new_version: Version) -> Dict[str, str]

Provide the environment dictionary for post_commit_hooks.

get_pre_commit_hook_env

get_pre_commit_hook_env(config: Config, current_version: Version, new_version: Version) -> Dict[str, str]

Provide the environment dictionary for pre_commit_hooks.

get_setup_hook_env

get_setup_hook_env(config: Config, current_version: Version) -> Dict[str, str]

Provide the environment dictionary for setup_hooks.

has_shell_syntax

has_shell_syntax(script: str) -> bool

Return True if the command string contains shell metacharacters.

new_version_env

new_version_env(config: Config, current_version: Version, new_version: Version) -> Dict[str, str]

Provide the environment dictionary for new_version serialized and tag name.

run_command

run_command(script: str, environment: Optional[dict] = None) -> subprocess.CompletedProcess

Run a command using argv-based execution (shell=False).

run_hooks

run_hooks(hooks: List[str], env: Dict[str, str], dry_run: bool = False, allow_shell_hooks: bool = False) -> None

Run a list of command-line programs, defaulting to safe argv-based execution.

run_post_commit_hooks

run_post_commit_hooks(config: Config, current_version: Version, new_version: Version, dry_run: bool = False) -> None

Run the post-commit hooks.

run_pre_commit_hooks

run_pre_commit_hooks(config: Config, current_version: Version, new_version: Version, dry_run: bool = False) -> None

Run the pre-commit hooks.

run_setup_hooks

run_setup_hooks(config: Config, current_version: Version, dry_run: bool = False) -> None

Run the setup hooks.

scm_env

scm_env(config: Config) -> Dict[str, str]

Provide the scm environment variables.

version_env

version_env(version: Version, version_prefix: str) -> Dict[str, str]

Provide the environment variables for each version component with a prefix.