Skip to main content

Poetry pre-commit Plugin

A Poetry plugin for automatically installing git pre-commit hooks whenever pre-commit is specified as a dependency of the project.

Motivation

Personally I find that running pre-commit install every time I start working on a new repository is very easy to forget - there have been numerous occasions where I'd forget this step, commit some changes only to be surprised later on by failing CI checks 😅 This plugin aims to solve this issue by doing this small step for me automatically behind the scenes.

Installation

The plugin requires Poetry version 1.2.0b1 or above. Since this is still a pre-release version, you have to specify it explicitly when installing:

curl -sSL https://install.python-poetry.org | python3.9 - --version 1.2.0b3

Once a valid version of Poetry is set up, you can install the plugin like so:

poetry self add poetry-pre-commit-plugin

For more in-depth information, please refer to Poetry's docs.

Usage

There's no way to use this plugin explicitly - it will work behind the scenes after you run either poetry install or poetry add. In either of those cases, the plugin will check the following conditions:

  1. Is the project inside a git repository?
  2. Is pre-commit listed as a dependency of the project (or, in the case of poetry add - was it just added)?
  3. Has the pre-commit hook not been activated yet (i.e. the file .git/hooks/pre-commit does not exist)?

If all conditions are met, the plugin will run pre-commit install for you.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry-pre-commit-plugin-0.1.1.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poetry_pre_commit_plugin-0.1.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file poetry-pre-commit-plugin-0.1.1.tar.gz.

File metadata

  • Download URL: poetry-pre-commit-plugin-0.1.1.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0b3 CPython/3.9.13 Darwin/21.5.0

File hashes

Hashes for poetry-pre-commit-plugin-0.1.1.tar.gz
Algorithm Hash digest
SHA256 862695d6624e2ba67f0d3ca74676159064704368551d06a83941c60b1b7ca359
MD5 1d755285e82bcf609156eaee37013ddc
BLAKE2b-256 517c20f7602218918098bb814084a7b5d2afd9be45c954df9dc181244e3bff09

See more details on using hashes here.

File details

Details for the file poetry_pre_commit_plugin-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_pre_commit_plugin-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 038e787f494e50ddeb9bde1652c3db81e2a2b8136298be5fc2222d39035bc070
MD5 a7d3e1160c7d2abce8a82895c000aa65
BLAKE2b-256 e9e175761ad9a06f39fb42f4f9069451715d8ecf15a6eddd8693f360865f3b5f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page