poetry plugin to register wrapped commands to use as pre-commit-hooks
Project description
poetry-plugin-hook
poetry
plugin to register wrapped commands to use as pre-commit-hooks
. all hook commands return zero on success and non-zero on failure.
install
$ pip install poetry-plugin-hook
or with poetry
$ poetry self add poetry-plugin-hook
hook latest
Wrapper for poetry show -o -T
command.
Exit code represents the number of outdated packages.
$ poetry hook latest && echo exit-code: $?
All top-level dependencies are up-to-date.
exit-code: 0
hook sync
Wrapper for poetry install --sync
command.
With --exit
option, the command returns the corresponding value as exit code. With it's default --exit=any
the sum of installs, updates and removals is returned.
$ poetry hook sync --dry-run && echo exit-code: $?
No dependencies to install or update.
exit-code: 0
pre-commit-config
Add the following to your .pre-commit-config.yaml
file.
repos:
- repo: https://github.com/d-chris/poetry-plugin-hook
rev: v1.1.0
hooks:
- id: poetry-hook-latest
- id: poetry-hook-sync
pre-commit-hooks
- id: poetry-hook-latest
name: poetry-hook-latest
description: Check if all top-level dependencies are up-to-date.
entry: poetry hook latest
language: system
pass_filenames: false
always_run: true
stages: [pre-push]
- id: poetry-hook-sync
name: poetry-hook-sync
description: Synchronize the environment with the locked packages and the specified groups.
entry: poetry hook sync
language: system
pass_filenames: false
files: ^(.*/)?(poetry\.lock|pyproject\.toml)$
Dependencies
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for poetry_plugin_hook-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30ce1f1d6ea4ca26f2ae7e74eb4f128963f1175360808c624dc17138f3e6fca2 |
|
MD5 | 16f688d39d9634edc766687ac7074f43 |
|
BLAKE2b-256 | 51c29709e248d586efcb0980ade17c35601c14bec0d576edf5c647b2ef546b2a |