diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 08f733c18e8..4d6eeae0396 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -21,3 +21,11 @@ pass_filenames: false files: ^poetry.lock$ args: ["-f", "requirements.txt", "-o", "requirements.txt"] + +- id: poetry-build + name: poetry-build + description: run poetry build build the source and wheels archive + entry: poetry build + language: python + language_version: python3 + pass_filenames: false diff --git a/docs/cli.md b/docs/cli.md index 5a5fd878f7e..072cac5f305 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -522,6 +522,10 @@ When `--only` is specified, `--with` and `--without` options are ignored. The `build` command builds the source and wheels archives. +{{% note %}} +This command is also available as a pre-commit hook. See [pre-commit hooks]({{< relref "pre-commit-hooks#poetry-build">}}) for more information. +{{% /note %}} + ```bash poetry build ``` diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index baff210811c..241b923809c 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -49,6 +49,17 @@ The hook takes the same arguments as the poetry command. For more information see the [lock command]({{< relref "cli#lock" >}}). +## poetry-build + +The `poetry-build` hook calls the `poetry build` command +To build the source and wheels archives. + +### Arguments + +The hook takes the same arguments as the poetry command. +For more information see the [build command]({{< relref "cli#build" >}}). + + ## poetry-export The `poetry-export` hook calls the `poetry export` command