Skip to content

Commit 483dd31

Browse files
abnradoering
authored andcommitted
Fix poetry-install pre-commit hook configuration
- Change language from python to system for poetry-install hook - Add default args: ["--sync"] to poetry-install hook - Update documentation with warning about versions up to 2.2.1 Resolves: #9393
1 parent d1211c0 commit 483dd31

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

.pre-commit-hooks.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
name: poetry-install
1919
description: run poetry install to install dependencies from the lock file
2020
entry: poetry install
21-
language: python
21+
language: system
22+
args: ["--sync"]
2223
pass_filenames: false
2324
stages: [post-checkout, post-merge]
2425
always_run: true

docs/pre-commit-hooks.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,20 @@ The `poetry-install` hook calls the `poetry install` command to make sure all lo
9393
In order to install this hook, you either need to specify `default_install_hook_types`, or you have
9494
to install it via `pre-commit install --install-hooks -t post-checkout -t post-merge`.
9595

96+
{{% warning %}}
97+
Versions up to and including 2.2.1 incorrectly configured the `poetry-install` hook with `language: python`.
98+
Starting from 2.2.2, the hook uses `language: system` and includes `args: ["--sync"]` by default.
99+
If you are upgrading from an earlier version, you may need to update your `.pre-commit-config.yaml` accordingly.
100+
{{% /warning %}}
101+
96102
### Arguments
97103

98104
The hook takes the same arguments as the poetry command.
99105
For more information, see the [install command]({{< relref "cli#install" >}}).
100106

107+
The default arguments are `args: ["--sync"]`, which ensures that the environment is synchronized
108+
with the lock file by removing any packages not in the lock file.
109+
101110
## Usage
102111

103112
For more information on how to use pre-commit, please see the [official documentation](https://pre-commit.com/).

0 commit comments

Comments
 (0)