Skip to content

prek

prek documentation

toolroom._stubs.prek.Prek

Bases: Tool[_R]

Autoupdate

Bases: Tool[_R2]

__call__

__call__(
    *,
    bleeding_edge: Flag = ...,
    cd: Value = ...,
    check: Flag = ...,
    color: Color | Sequence[Color] | None = ...,
    config: Value = ...,
    cooldown_days: Value = ...,
    dry_run: Flag = ...,
    exclude_repo: Value = ...,
    exclude_tag: Value = ...,
    exit_code: Flag = ...,
    freeze: Flag = ...,
    include_tag: Value = ...,
    jobs: Value = ...,
    log_file: Value = ...,
    no_progress: Flag = ...,
    quiet: Flag = ...,
    refresh: Flag = ...,
    repo: Value = ...,
    repo_exclude_tag: Value = ...,
    repo_include_tag: Value = ...,
    verbose: Flag = ...,
    **flags: Any,
) -> _R2

Update configured repositories

Parameters:

Name Type Description Default
bleeding_edge Flag

Update to the bleeding edge of the default branch instead of the latest tagged version.

...
cd Value

Change to directory before running.

...
check Flag

Alias of --dry-run --exit-code.

...
color Color | Sequence[Color] | None

Whether to use color in output. Defaults to auto.

...
config Value

Path to alternate config file.

...
cooldown_days Value

Minimum release age (in days) required for a version to be eligible.

...
dry_run Flag

Do not write changes to the config file, only display what would be changed.

...
exclude_repo Value

Do not update this repository. May be repeated: a list emits the flag once per item.

...
exclude_tag Value

Ignore tags matching this glob pattern. May be repeated: a list emits the flag once per item.

...
exit_code Flag

Exit with status 1 if updates are available.

...
freeze Flag

Store "frozen" hashes in rev instead of tag names.

...
include_tag Value

Only consider tags matching this glob pattern. May be repeated: a list emits the flag once per item.

...
jobs Value

Number of threads to use. Defaults to 0.

...
log_file Value

Write trace logs to the specified file.

...
no_progress Flag

Hide all progress outputs.

...
quiet Flag

Use quiet output.

...
refresh Flag

Refresh all cached data.

...
repo Value

Only update this repository. May be repeated: a list emits the flag once per item.

...
repo_exclude_tag Value

Ignore tags matching this glob pattern for a repository (<repo>=<pattern>). May be repeated: a list emits the flag once per item.

...
repo_include_tag Value

Only consider tags matching this glob pattern for a repository (<repo>=<pattern>). May be repeated: a list emits the flag once per item.

...
verbose Flag

Use verbose output.

...

Clean

Bases: Tool[_R2]

__call__

__call__(
    *,
    cd: Value = ...,
    color: Color | Sequence[Color] | None = ...,
    config: Value = ...,
    log_file: Value = ...,
    no_progress: Flag = ...,
    quiet: Flag = ...,
    refresh: Flag = ...,
    verbose: Flag = ...,
    **flags: Any,
) -> _R2

Remove all prek cached data

Parameters:

Name Type Description Default
cd Value

Change to directory before running.

...
color Color | Sequence[Color] | None

Whether to use color in output. Defaults to auto.

...
config Value

Path to alternate config file.

...
log_file Value

Write trace logs to the specified file.

...
no_progress Flag

Hide all progress outputs.

...
quiet Flag

Use quiet output.

...
refresh Flag

Refresh all cached data.

...
verbose Flag

Use verbose output.

...

Install

Bases: Tool[_R2]

__call__

__call__(
    *args: str | PathLike[str],
    allow_missing_config: Flag = ...,
    cd: Value = ...,
    color: Color | Sequence[Color] | None = ...,
    config: Value = ...,
    force: Flag = ...,
    git_dir: Value = ...,
    hook_type: HookType | Sequence[HookType] | None = ...,
    log_file: Value = ...,
    no_progress: Flag = ...,
    overwrite: Flag = ...,
    prepare_hooks: Flag = ...,
    quiet: Flag = ...,
    refresh: Flag = ...,
    skip: Value = ...,
    verbose: Flag = ...,
    **flags: Any,
) -> _R2

Install prek Git hook shims

Parameters:

Name Type Description Default
allow_missing_config Flag

Allow a missing configuration file.

...
cd Value

Change to directory before running.

...
color Color | Sequence[Color] | None

Whether to use color in output. Defaults to auto.

...
config Value

Path to alternate config file.

...
force Flag

Force installation and overwrite existing Git shims. Added in 0.4.12.

...
git_dir Value

Install Git shims into the hooks subdirectory of the given git directory (<GIT_DIR>/hooks/).

...
hook_type HookType | Sequence[HookType] | None

Which Git shim(s) to install.

...
log_file Value

Write trace logs to the specified file.

...
no_progress Flag

Hide all progress outputs.

...
overwrite Flag

Overwrite existing Git shims. Gone since 0.4.12.

...
prepare_hooks Flag

Also prepare environments for all hooks used in the config file.

...
quiet Flag

Use quiet output.

...
refresh Flag

Refresh all cached data.

...
skip Value

Skip the specified hooks or projects.

...
verbose Flag

Use verbose output.

...

Run

Bases: Tool[_R2]

__call__

__call__(
    *args: str | PathLike[str],
    all_files: Flag = ...,
    cd: Value = ...,
    color: Color | Sequence[Color] | None = ...,
    config: Value = ...,
    directory: Value = ...,
    dry_run: Flag = ...,
    fail_fast: Flag = ...,
    files: Value = ...,
    from_ref: Value = ...,
    glob: Value = ...,
    group: Value = ...,
    last_commit: Flag = ...,
    log_file: Value = ...,
    no_group: Value = ...,
    no_progress: Flag = ...,
    quiet: Flag = ...,
    refresh: Flag = ...,
    require_group: Value = ...,
    show_diff_on_failure: Flag = ...,
    skip: Value = ...,
    stage: Stage | Sequence[Stage] | None = ...,
    to_ref: Value = ...,
    verbose: Flag = ...,
    **flags: Any,
) -> _R2

Run configured hooks

Parameters:

Name Type Description Default
all_files Flag

Run hooks on all tracked files in the repository.

...
cd Value

Change to directory before running.

...
color Color | Sequence[Color] | None

Whether to use color in output. Defaults to auto.

...
config Value

Path to alternate config file.

...
directory Value

Run hooks on tracked files under the specified directory.

...
dry_run Flag

Do not run the hooks, but print the hooks that would have been run.

...
fail_fast Flag

Stop running hooks after the first failure.

...
files Value

Run hooks on the specified file paths. May be repeated: a list emits the flag once per item.

...
from_ref Value

The original ref in a <from_ref>...<to_ref> diff expression.

...
glob Value

Run hooks on tracked files matching the specified glob pattern. Added in 0.4.11.

...
group Value

Run hooks belonging to the specified group. Added in 0.4.4.

...
last_commit Flag

Run hooks against the last commit.

...
log_file Value

Write trace logs to the specified file.

...
no_group Value

Do not run hooks belonging to the specified group. Added in 0.4.4.

...
no_progress Flag

Hide all progress outputs.

...
quiet Flag

Use quiet output.

...
refresh Flag

Refresh all cached data.

...
require_group Value

Run hooks belonging to every specified group. Added in 0.4.12.

...
show_diff_on_failure Flag

When hooks fail, run git diff directly afterward.

...
skip Value

Skip the specified hooks or projects.

...
stage Stage | Sequence[Stage] | None

The stage during which the hook is fired.

...
to_ref Value

The destination ref in a from_ref...to_ref diff expression.

...
verbose Flag

Use verbose output.

...

Uninstall

Bases: Tool[_R2]

__call__

__call__(
    *,
    all: Flag = ...,
    cd: Value = ...,
    color: Color | Sequence[Color] | None = ...,
    config: Value = ...,
    git_dir: Value = ...,
    hook_type: HookType | Sequence[HookType] | None = ...,
    log_file: Value = ...,
    no_progress: Flag = ...,
    quiet: Flag = ...,
    refresh: Flag = ...,
    verbose: Flag = ...,
    **flags: Any,
) -> _R2

Uninstall prek Git hook shims

Parameters:

Name Type Description Default
all Flag

Uninstall all prek-managed Git shims.

...
cd Value

Change to directory before running.

...
color Color | Sequence[Color] | None

Whether to use color in output. Defaults to auto.

...
config Value

Path to alternate config file.

...
git_dir Value

Uninstall Git shims from the hooks subdirectory of the given git directory (<GIT_DIR>/hooks/).

...
hook_type HookType | Sequence[HookType] | None

Which Git shim(s) to uninstall.

...
log_file Value

Write trace logs to the specified file.

...
no_progress Flag

Hide all progress outputs.

...
quiet Flag

Use quiet output.

...
refresh Flag

Refresh all cached data.

...
verbose Flag

Use verbose output.

...

__call__

__call__(
    *args: str | PathLike[str],
    all_files: Flag = ...,
    cd: Value = ...,
    color: Color | Sequence[Color] | None = ...,
    config: Value = ...,
    directory: Value = ...,
    dry_run: Flag = ...,
    fail_fast: Flag = ...,
    files: Value = ...,
    from_ref: Value = ...,
    glob: Value = ...,
    group: Value = ...,
    last_commit: Flag = ...,
    log_file: Value = ...,
    no_group: Value = ...,
    no_progress: Flag = ...,
    quiet: Flag = ...,
    refresh: Flag = ...,
    require_group: Value = ...,
    show_diff_on_failure: Flag = ...,
    skip: Value = ...,
    stage: Stage | Sequence[Stage] | None = ...,
    to_ref: Value = ...,
    verbose: Flag = ...,
    **flags: Any,
) -> _R

A fast Git hook manager written in Rust, designed as a drop-in alternative to pre-commit, reimagined.

Parameters:

Name Type Description Default
all_files Flag

Run hooks on all tracked files in the repository.

...
cd Value

Change to directory before running.

...
color Color | Sequence[Color] | None

Whether to use color in output. Defaults to auto.

...
config Value

Path to alternate config file.

...
directory Value

Run hooks on tracked files under the specified directory.

...
dry_run Flag

Do not run the hooks, but print the hooks that would have been run.

...
fail_fast Flag

Stop running hooks after the first failure.

...
files Value

Run hooks on the specified file paths. May be repeated: a list emits the flag once per item.

...
from_ref Value

The original ref in a <from_ref>...<to_ref> diff expression.

...
glob Value

Run hooks on tracked files matching the specified glob pattern. Added in 0.4.11.

...
group Value

Run hooks belonging to the specified group. Added in 0.4.4.

...
last_commit Flag

Run hooks against the last commit.

...
log_file Value

Write trace logs to the specified file.

...
no_group Value

Do not run hooks belonging to the specified group. Added in 0.4.4.

...
no_progress Flag

Hide all progress outputs.

...
quiet Flag

Use quiet output.

...
refresh Flag

Refresh all cached data.

...
require_group Value

Run hooks belonging to every specified group. Added in 0.4.12.

...
show_diff_on_failure Flag

When hooks fail, run git diff directly afterward.

...
skip Value

Skip the specified hooks or projects.

...
stage Stage | Sequence[Stage] | None

The stage during which the hook is fired.

...
to_ref Value

The destination ref in a from_ref...to_ref diff expression.

...
verbose Flag

Use verbose output.

...

flags

flags(
    *,
    all_files: Flag = ...,
    cd: Value = ...,
    color: Color | Sequence[Color] | None = ...,
    config: Value = ...,
    directory: Value = ...,
    dry_run: Flag = ...,
    fail_fast: Flag = ...,
    files: Value = ...,
    from_ref: Value = ...,
    glob: Value = ...,
    group: Value = ...,
    last_commit: Flag = ...,
    log_file: Value = ...,
    no_group: Value = ...,
    no_progress: Flag = ...,
    quiet: Flag = ...,
    refresh: Flag = ...,
    require_group: Value = ...,
    show_diff_on_failure: Flag = ...,
    skip: Value = ...,
    stage: Stage | Sequence[Stage] | None = ...,
    to_ref: Value = ...,
    verbose: Flag = ...,
    **flags: Any,
) -> Self

Bind tool-level global options before the subcommand.

tools.docker.flags(host=...) puts a tool's own options ahead of the verb, where they belong.