From 483dd310034510d1bb9a22a65af9e23a251e60dc Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Tue, 30 Sep 2025 20:51:23 +0000 Subject: [PATCH] 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 --- .pre-commit-hooks.yaml | 3 ++- docs/pre-commit-hooks.md | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index bdacdbdf659..b198d010739 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -18,7 +18,8 @@ name: poetry-install description: run poetry install to install dependencies from the lock file entry: poetry install - language: python + language: system + args: ["--sync"] pass_filenames: false stages: [post-checkout, post-merge] always_run: true diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index 9a0a00ba5c4..e14d87e73c7 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -93,11 +93,20 @@ The `poetry-install` hook calls the `poetry install` command to make sure all lo In order to install this hook, you either need to specify `default_install_hook_types`, or you have to install it via `pre-commit install --install-hooks -t post-checkout -t post-merge`. +{{% warning %}} +Versions up to and including 2.2.1 incorrectly configured the `poetry-install` hook with `language: python`. +Starting from 2.2.2, the hook uses `language: system` and includes `args: ["--sync"]` by default. +If you are upgrading from an earlier version, you may need to update your `.pre-commit-config.yaml` accordingly. +{{% /warning %}} + ### Arguments The hook takes the same arguments as the poetry command. For more information, see the [install command]({{< relref "cli#install" >}}). +The default arguments are `args: ["--sync"]`, which ensures that the environment is synchronized +with the lock file by removing any packages not in the lock file. + ## Usage For more information on how to use pre-commit, please see the [official documentation](https://pre-commit.com/).