Skip to main content

Poetry plugin for automatically installing pre-commit hook when it is added to a project

Project description

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.


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.


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 | 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.


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.

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-pre-commit-plugin-0.1.1.tar.gz (15.5 kB view hashes)

Uploaded Source

Built Distribution

poetry_pre_commit_plugin-0.1.1-py3-none-any.whl (16.0 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