Skip to main content

poetry plugin to register wrapped commands to use as pre-commit-hooks

Project description

poetry-plugin-hook

PyPI - Python Version PyPI - Version PyPI - Downloads PyPI - License GitHub - Pytest GitHub - Page GitHub - Release pre-commit codecov


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

PyPI - cleo PyPI - poetry


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

poetry_plugin_hook-1.1.0.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

poetry_plugin_hook-1.1.0-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page