Skip to main content

Poetry pre-commit Plugin

PyPI

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.

Release files for poetry-pre-commit-plugin 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for poetry-pre-commit-plugin 0.2.2
File Size Uploaded
poetry_pre_commit_plugin-0.2.2.tar.gz 14.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for poetry-pre-commit-plugin 0.2.2
File Interpreter ABI Platform
poetry_pre_commit_plugin-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 31.0 kB

Release files / poetry_pre_commit_plugin-0.2.2.tar.gz

Download URL poetry_pre_commit_plugin-0.2.2.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a2aef66039681216295eb0025cba599d9997709b701850c1b2991df67b70531c
BLAKE2b-256 checksum
How to use checksums
3c18906f8634eaf2ee82c716d7941535985bdfc1c543ab8a833e2d225039514c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.9.13 Darwin/23.6.0

Release files / poetry_pre_commit_plugin-0.2.2-py3-none-any.whl

Download URL poetry_pre_commit_plugin-0.2.2-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75ec4aad2711eff98678a5e79a7166fac4d245c0ac9a8734ecfd75083cd1bc55
BLAKE2b-256 checksum
How to use checksums
1b426167b5ec1e14ba648747ae8b9a479a182bd9fe9c0329344ac3d485b3799f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.9.13 Darwin/23.6.0

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page