From 18443e7929d04f4f09614eeacd2f8e7a337f2a5b Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 6 Jun 2020 13:05:24 +0200 Subject: [PATCH 01/28] added pre-commit hooks for check & lock --- .pre-commit-hooks.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .pre-commit-hooks.yaml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 00000000000..af8513a7f9b --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,14 @@ +- id: poetry-check + name: poetry-check + description: run poetry check to validate config + entry: poetry check + language: python + language_version: python3 + pass_filenames: false +- id: poetry-lock + name: poetry-lock + description: run poetry lock to update lock file + entry: poetry lock + language: python + language_version: python3 + pass_filenames: false From 691c250c7f81f97858c4e32b0056500980e513e7 Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 6 Jun 2020 13:07:29 +0200 Subject: [PATCH 02/28] added pre-commit hook for export requirements.txt --- .pre-commit-hooks.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index af8513a7f9b..2b8834a4863 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -12,3 +12,11 @@ language: python language_version: python3 pass_filenames: false +- id: poetry-export + name: poetry-export + description: run poetry export to sync lock file with requirements.txt + entry: poetry export + language: python + language_version: python3 + pass_filenames: false + args: ["-f", "requirements.txt"] From 42deba2c7e94174f36004a02be3f2c55e990800d Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 6 Jun 2020 15:29:10 +0200 Subject: [PATCH 03/28] added pre-commit hooks to docs --- docs/docs/cli.md | 15 ++++++++ docs/docs/pre-commit-hooks.md | 72 +++++++++++++++++++++++++++++++++++ docs/mkdocs.yml | 1 + 3 files changed, 88 insertions(+) create mode 100644 docs/docs/pre-commit-hooks.md diff --git a/docs/docs/cli.md b/docs/docs/cli.md index 1a2615a9d9d..17394922a54 100644 --- a/docs/docs/cli.md +++ b/docs/docs/cli.md @@ -403,6 +403,11 @@ poetry shell The `check` command validates the structure of the `pyproject.toml` file and returns a detailed report if there are any errors. +!!!note + + This command is also available as `pre-commit` hook. + See [pre-commit hooks](/docs/pre-commit-hooks#poetry-check) for more information. + ```bash poetry check ``` @@ -419,6 +424,11 @@ poetry search requests pendulum This command locks (without installing) the dependencies specified in `pyproject.toml`. +!!!note + + This command is also available as `pre-commit` hook. + See [pre-commit hooks](/docs/pre-commit-hooks#poetry-lock) for more information. + ```bash poetry lock ``` @@ -462,6 +472,11 @@ poetry export -f requirements.txt --output requirements.txt Only the `requirements.txt` format is currently supported. +!!!note + + This command is also available as `pre-commit` hook. + See [pre-commit hooks](/docs/pre-commit-hooks#poetry-export) for more information. + ### Options * `--format (-f)`: The format to export to (default: `requirements.txt`). diff --git a/docs/docs/pre-commit-hooks.md b/docs/docs/pre-commit-hooks.md new file mode 100644 index 00000000000..5d9f9097117 --- /dev/null +++ b/docs/docs/pre-commit-hooks.md @@ -0,0 +1,72 @@ +# pre-commit hooks + +`pre-commit` is a tool which manages running of +[git hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) scripts. +See the official documentation for more information: [pre-commit.com](https://pre-commit.com/) + +Below you can see the available `pre-commit` hooks you can use. + + +## poetry-check + +The `poetry-check` hook calls the `poetry check` command +to make sure the poetry configuration does not get committed in a broken state. + +### Arguments + +The hook takes the same arguments as the CLI command. +For more information see the [check command](/docs/cli#check). + + +## poetry-lock + +The `poetry-lock` hook calls the `poetry lock` command +to make sure the lock file is up-to-date when committing changes. + +### Arguments + +The hook takes the same arguments as the CLI command. +For more information see the [lock command](/docs/cli#lock). + + +## poetry-export + +The `poetry-export` hook calls the `poetry export` command +to sync your `requirements.txt` file with your current dependencies. + +!!!note + + It is recommended to run the [`poetry-lock`](#poetry-lock) hook prior to this one. + +### Arguments + +The hook takes the same arguments as the CLI command. +For more information see the [export command](/docs/cli#export). + +If no arguments are given the hook falls back to `args: ["-f", "requirements.txt"]`. +If you want to see the output on the commandline add `verbose: true` to `poetry-export` +in your `.pre-commit-config.yaml` file like so: + +```yaml +hooks: + - id: poetry-export + verbose: true +``` + + +## Usage + +For how to use `pre-commit` please see the [official documentation](https://pre-commit.com/). + +Example `.pre-commit-config.yaml` file: + +```yaml +repos: + - repo: https://github.com/python-poetry/poetry + rev: '' # add version here + hooks: + - id: poetry-check + - id: poetry-lock + - id: poetry-export + args: ["-f", "requirements.txt", "-o", "requirements.txt"] +``` diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index c35ef9579b4..6ae7908e675 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -17,6 +17,7 @@ nav: - Managing environments: managing-environments.md - Dependency specification: dependency-specification.md - The pyproject.toml file: pyproject.md + - pre-commit hooks: pre-commit-hooks.md - Contributing: contributing.md - FAQ: faq.md From c41384ed305370d3b0a7e68b6f6e81d699018260 Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 6 Jun 2020 15:35:22 +0200 Subject: [PATCH 04/28] fixed linting issues --- docs/docs/pre-commit-hooks.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/pre-commit-hooks.md b/docs/docs/pre-commit-hooks.md index 5d9f9097117..3a6d993b37e 100644 --- a/docs/docs/pre-commit-hooks.md +++ b/docs/docs/pre-commit-hooks.md @@ -1,7 +1,7 @@ # pre-commit hooks -`pre-commit` is a tool which manages running of -[git hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) scripts. +`pre-commit` is a tool which manages running of +[git hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) scripts. See the official documentation for more information: [pre-commit.com](https://pre-commit.com/) Below you can see the available `pre-commit` hooks you can use. @@ -9,12 +9,12 @@ Below you can see the available `pre-commit` hooks you can use. ## poetry-check -The `poetry-check` hook calls the `poetry check` command +The `poetry-check` hook calls the `poetry check` command to make sure the poetry configuration does not get committed in a broken state. ### Arguments -The hook takes the same arguments as the CLI command. +The hook takes the same arguments as the CLI command. For more information see the [check command](/docs/cli#check). From 0538b809da01f15ad43d46964536b5cc053b59f5 Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 6 Jun 2020 21:03:45 +0200 Subject: [PATCH 05/28] separated pre-commit-hooks by one line --- .pre-commit-hooks.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 2b8834a4863..5cc0d351bc6 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -5,6 +5,7 @@ language: python language_version: python3 pass_filenames: false + - id: poetry-lock name: poetry-lock description: run poetry lock to update lock file @@ -12,6 +13,7 @@ language: python language_version: python3 pass_filenames: false + - id: poetry-export name: poetry-export description: run poetry export to sync lock file with requirements.txt From 7dac12dca3babe40d29c6ee5971eb029b2d4452f Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 6 Jun 2020 21:05:59 +0200 Subject: [PATCH 06/28] fixed typo in cli.md --- docs/docs/cli.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/cli.md b/docs/docs/cli.md index 17394922a54..559e376b7d7 100644 --- a/docs/docs/cli.md +++ b/docs/docs/cli.md @@ -405,7 +405,7 @@ and returns a detailed report if there are any errors. !!!note - This command is also available as `pre-commit` hook. + This command is also available as a `pre-commit` hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-check) for more information. ```bash @@ -426,7 +426,7 @@ This command locks (without installing) the dependencies specified in `pyproject !!!note - This command is also available as `pre-commit` hook. + This command is also available as a `pre-commit` hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-lock) for more information. ```bash @@ -474,7 +474,7 @@ poetry export -f requirements.txt --output requirements.txt !!!note - This command is also available as `pre-commit` hook. + This command is also available as a `pre-commit` hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-export) for more information. ### Options From 66f2d2c533a2cbe9911ae692783c7ed875d36d57 Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 6 Jun 2020 21:09:05 +0200 Subject: [PATCH 07/28] changed default of poetry-export hook to export to file --- .pre-commit-hooks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 5cc0d351bc6..c88e4ec4332 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -21,4 +21,4 @@ language: python language_version: python3 pass_filenames: false - args: ["-f", "requirements.txt"] + args: ["-f", "requirements.txt", "-o", "requirements.txt"] From d466aa2889c933beb9778d03a90c32d8703d8acc Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 6 Jun 2020 21:10:06 +0200 Subject: [PATCH 08/28] renamed CLI command to poetry command in pre-commit-hooks.md --- docs/docs/pre-commit-hooks.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/pre-commit-hooks.md b/docs/docs/pre-commit-hooks.md index 3a6d993b37e..80c13b037da 100644 --- a/docs/docs/pre-commit-hooks.md +++ b/docs/docs/pre-commit-hooks.md @@ -14,7 +14,7 @@ to make sure the poetry configuration does not get committed in a broken state. ### Arguments -The hook takes the same arguments as the CLI command. +The hook takes the same arguments as the poetry command. For more information see the [check command](/docs/cli#check). @@ -25,7 +25,7 @@ to make sure the lock file is up-to-date when committing changes. ### Arguments -The hook takes the same arguments as the CLI command. +The hook takes the same arguments as the poetry command. For more information see the [lock command](/docs/cli#lock). @@ -40,7 +40,7 @@ to sync your `requirements.txt` file with your current dependencies. ### Arguments -The hook takes the same arguments as the CLI command. +The hook takes the same arguments as the poetry command. For more information see the [export command](/docs/cli#export). If no arguments are given the hook falls back to `args: ["-f", "requirements.txt"]`. From 100ce8bd396c03a059a4c538314fead7b54664a8 Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 6 Jun 2020 21:13:51 +0200 Subject: [PATCH 09/28] updated docs for poetry-export hook to match new default --- docs/docs/pre-commit-hooks.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/docs/pre-commit-hooks.md b/docs/docs/pre-commit-hooks.md index 80c13b037da..f25f89ed8de 100644 --- a/docs/docs/pre-commit-hooks.md +++ b/docs/docs/pre-commit-hooks.md @@ -43,13 +43,16 @@ to sync your `requirements.txt` file with your current dependencies. The hook takes the same arguments as the poetry command. For more information see the [export command](/docs/cli#export). -If no arguments are given the hook falls back to `args: ["-f", "requirements.txt"]`. -If you want to see the output on the commandline add `verbose: true` to `poetry-export` +`args: ["-f", "requirements.txt", "-o", "requirements.txt"]` are the default arguments +which will create/update the requirements.txt file in the current working directory. + +For output to the console change the arguments and add `verbose: true` to `poetry-export` in your `.pre-commit-config.yaml` file like so: ```yaml hooks: - id: poetry-export + args: ["-f", "requirements.txt"] verbose: true ``` From 31d5b4e42d404aa0d14167c43f6d19ce40194b97 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Thu, 18 Jun 2020 09:04:18 +0200 Subject: [PATCH 10/28] Added note for pre-commit args --- docs/docs/pre-commit-hooks.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/docs/pre-commit-hooks.md b/docs/docs/pre-commit-hooks.md index f25f89ed8de..02721ba3014 100644 --- a/docs/docs/pre-commit-hooks.md +++ b/docs/docs/pre-commit-hooks.md @@ -7,6 +7,13 @@ See the official documentation for more information: [pre-commit.com](https://pr Below you can see the available `pre-commit` hooks you can use. +!!!note + + If you specify the `args:` section for a hook in your pre-commit config + the default `args:` are overwritten. So if you want to add arguments + you need to specify the default ones in your config also. + + ## poetry-check The `poetry-check` hook calls the `poetry check` command From 74a5e11def7912cc4b60e4384982e218c8a363b5 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Thu, 18 Jun 2020 09:10:51 +0200 Subject: [PATCH 11/28] fixed linting issues in docs --- docs/docs/pre-commit-hooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/pre-commit-hooks.md b/docs/docs/pre-commit-hooks.md index 02721ba3014..0b3198a4639 100644 --- a/docs/docs/pre-commit-hooks.md +++ b/docs/docs/pre-commit-hooks.md @@ -9,8 +9,8 @@ Below you can see the available `pre-commit` hooks you can use. !!!note - If you specify the `args:` section for a hook in your pre-commit config - the default `args:` are overwritten. So if you want to add arguments + If you specify the `args:` section for a hook in your pre-commit config + the default `args:` are overwritten. So if you want to add arguments you need to specify the default ones in your config also. From 006d43d7d702199d8a2921feddd3551801c37948 Mon Sep 17 00:00:00 2001 From: Cielquan Date: Sat, 7 Nov 2020 09:09:12 +0100 Subject: [PATCH 12/28] docs: added example for exporting dev deps --- docs/docs/pre-commit-hooks.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/docs/pre-commit-hooks.md b/docs/docs/pre-commit-hooks.md index 0b3198a4639..89c17fcb8ca 100644 --- a/docs/docs/pre-commit-hooks.md +++ b/docs/docs/pre-commit-hooks.md @@ -63,6 +63,14 @@ hooks: verbose: true ``` +Or to put the `dev` dependencies into the `requirements.txt` also use this: + +```yaml +hooks: + - id: poetry-export + args: ["--dev", "-f", "requirements.txt", "-o", "requirements.txt"] +``` + ## Usage From a570e84240d4af68a016be69f2a5ccea78331fdc Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Sat, 5 Jun 2021 15:23:21 +0200 Subject: [PATCH 13/28] add pre-commit hook to check pre-commit-hooks file --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9377e9a6992..8667b2583ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,3 +28,8 @@ repos: - id: end-of-file-fixer exclude: ^tests/.*/fixtures/.* - id: debug-statements + + - repo: https://github.com/pre-commit/pre-commit + rev: v2.13.0 + hooks: + - id: validate_manifest From 5c5ccdaab1c4c7c3f4fdecb498a13ebef25ce940 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Sat, 5 Jun 2021 16:06:05 +0200 Subject: [PATCH 14/28] update docs for new doc setup --- docs/cli.md | 13 ++++--------- docs/{docs => }/pre-commit-hooks.md | 16 ++++++++-------- 2 files changed, 12 insertions(+), 17 deletions(-) rename docs/{docs => }/pre-commit-hooks.md (86%) diff --git a/docs/cli.md b/docs/cli.md index fae6f9d28d9..f683416f56a 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -468,10 +468,9 @@ poetry shell The `check` command validates the structure of the `pyproject.toml` file and returns a detailed report if there are any errors. -!!!note - - This command is also available as a `pre-commit` hook. - See [pre-commit hooks](/docs/pre-commit-hooks#poetry-check) for more information. +{{% note %}} +This command is also available as a `pre-commit` hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-check) for more information. +{{% /note %}} ```bash poetry check @@ -540,13 +539,9 @@ poetry export -f requirements.txt --output requirements.txt {{% note %}} Only the `requirements.txt` format is currently supported. +This command is also available as a `pre-commit` hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-export) for more information. {{% /note %}} -!!!note - - This command is also available as a `pre-commit` hook. - See [pre-commit hooks](/docs/pre-commit-hooks#poetry-export) for more information. - ### Options * `--format (-f)`: The format to export to (default: `requirements.txt`). diff --git a/docs/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md similarity index 86% rename from docs/docs/pre-commit-hooks.md rename to docs/pre-commit-hooks.md index 89c17fcb8ca..067269653a1 100644 --- a/docs/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -7,11 +7,11 @@ See the official documentation for more information: [pre-commit.com](https://pr Below you can see the available `pre-commit` hooks you can use. -!!!note - - If you specify the `args:` section for a hook in your pre-commit config - the default `args:` are overwritten. So if you want to add arguments - you need to specify the default ones in your config also. +{{% note %}} +If you specify the `args:` section for a hook in your pre-commit config +the default `args:` are overwritten. So if you want to add arguments +you need to specify the default ones in your config also. +{{% /note %}} ## poetry-check @@ -41,9 +41,9 @@ For more information see the [lock command](/docs/cli#lock). The `poetry-export` hook calls the `poetry export` command to sync your `requirements.txt` file with your current dependencies. -!!!note - - It is recommended to run the [`poetry-lock`](#poetry-lock) hook prior to this one. +{{% note %}} +It is recommended to run the [`poetry-lock`](#poetry-lock) hook prior to this one. +{{% /note %}} ### Arguments From 6c2db9f1ef4a437461ffac058f96566a1a09de19 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Sat, 5 Jun 2021 16:06:51 +0200 Subject: [PATCH 15/28] remove readded mkdocs.yml --- docs/mkdocs.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 docs/mkdocs.yml diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml deleted file mode 100644 index a99bd0b4a6f..00000000000 --- a/docs/mkdocs.yml +++ /dev/null @@ -1,32 +0,0 @@ -site_name: Poetry documentation - -theme: - name: null - custom_dir: theme - -extra: - version: 2.0 - -nav: - - Introduction: index.md - - Basic Usage: basic-usage.md - - Libraries: libraries.md - - Commands: cli.md - - Configuration: configuration.md - - Repositories: repositories.md - - Managing environments: managing-environments.md - - Dependency specification: dependency-specification.md - - Plugins: plugins.md - - The pyproject.toml file: pyproject.md - - pre-commit hooks: pre-commit-hooks.md - - Contributing: contributing.md - - FAQ: faq.md - -markdown_extensions: - - codehilite - - admonition - - pymdownx.superfences - - toc: - permalink:  - - markdown_include.include: - base_path: docs From fdb12c1f47db0e7ae54c466d62073a7ec08c5ab5 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Sat, 5 Jun 2021 16:18:30 +0200 Subject: [PATCH 16/28] add yml config part to added docs file --- docs/pre-commit-hooks.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index 067269653a1..c8ccbb23fa3 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -1,3 +1,14 @@ +--- +title: "pre-commit hooks" +draft: false +type: docs +layout: single + +menu: + docs: + weight: 120 +--- + # pre-commit hooks `pre-commit` is a tool which manages running of From 9a479f9cb591c45b2edf5271729aae34e2f91521 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Sat, 5 Jun 2021 16:47:47 +0200 Subject: [PATCH 17/28] add 'files' constraint to pre-commit hooks This will reduce the workload for pre-commit on commits not changing files the hooks are checking. Thanks @graingert for pointing at the issue and @asottile futher clarification. See discussion on PR #2511. --- .pre-commit-hooks.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index c88e4ec4332..b1b45312627 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -5,6 +5,7 @@ language: python language_version: python3 pass_filenames: false + files: '^.*/pyproject\.toml$' - id: poetry-lock name: poetry-lock @@ -21,4 +22,5 @@ language: python language_version: python3 pass_filenames: false + files: '^.*/poetry\.lock$' args: ["-f", "requirements.txt", "-o", "requirements.txt"] From 33576c63b0e0be14858277a4ad8ce664eb96c850 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:04:59 +0100 Subject: [PATCH 18/28] Update docs/pre-commit-hooks.md Co-authored-by: Bjorn Neergaard --- docs/pre-commit-hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index c8ccbb23fa3..aed6163da20 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -85,7 +85,7 @@ hooks: ## Usage -For how to use `pre-commit` please see the [official documentation](https://pre-commit.com/). +For more information on how to use pre-commit please see the [official documentation](https://pre-commit.com/). Example `.pre-commit-config.yaml` file: From 7d1a99cf760c752fdf84660e1780a36a8b3e77fc Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:06:24 +0100 Subject: [PATCH 19/28] Update docs/pre-commit-hooks.md Co-authored-by: Bjorn Neergaard --- docs/pre-commit-hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index aed6163da20..88da2b43755 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -87,7 +87,7 @@ hooks: For more information on how to use pre-commit please see the [official documentation](https://pre-commit.com/). -Example `.pre-commit-config.yaml` file: +A full `.pre-commit-config.yaml` example: ```yaml repos: From fd36526832fec85d63de590f90c1d7dec9664141 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:08:02 +0100 Subject: [PATCH 20/28] Update docs/pre-commit-hooks.md Co-authored-by: Bjorn Neergaard --- docs/pre-commit-hooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index 88da2b43755..0ddabfb5432 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -64,8 +64,8 @@ For more information see the [export command](/docs/cli#export). `args: ["-f", "requirements.txt", "-o", "requirements.txt"]` are the default arguments which will create/update the requirements.txt file in the current working directory. -For output to the console change the arguments and add `verbose: true` to `poetry-export` -in your `.pre-commit-config.yaml` file like so: +You may add `verbose: true` in your `.pre-commit-config.yaml` in order to output to the +console: ```yaml hooks: From e550c53a78fd0c5daf470253a0deffc91e9d1e37 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:08:25 +0100 Subject: [PATCH 21/28] Update docs/pre-commit-hooks.md Co-authored-by: Bjorn Neergaard --- docs/pre-commit-hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index 0ddabfb5432..8e1da3b31c1 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -61,7 +61,7 @@ It is recommended to run the [`poetry-lock`](#poetry-lock) hook prior to this on The hook takes the same arguments as the poetry command. For more information see the [export command](/docs/cli#export). -`args: ["-f", "requirements.txt", "-o", "requirements.txt"]` are the default arguments +The default arguments are `args: ["-f", "requirements.txt", "-o", "requirements.txt"]`, which will create/update the requirements.txt file in the current working directory. You may add `verbose: true` in your `.pre-commit-config.yaml` in order to output to the From 4b38d72dc2ac2ad5472c55373cfe2883af66b98c Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:08:50 +0100 Subject: [PATCH 22/28] Update docs/pre-commit-hooks.md Co-authored-by: Bjorn Neergaard --- docs/pre-commit-hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index 8e1da3b31c1..05aa965a921 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -15,7 +15,7 @@ menu: [git hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) scripts. See the official documentation for more information: [pre-commit.com](https://pre-commit.com/) -Below you can see the available `pre-commit` hooks you can use. +This document provides a list of available pre-commit hooks provided by Poetry. {{% note %}} From f317b2daf2e08d9b18723c6bb84bc770d21e6207 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:09:08 +0100 Subject: [PATCH 23/28] Update docs/cli.md Co-authored-by: Bjorn Neergaard --- docs/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cli.md b/docs/cli.md index 219e7671561..d35231a9960 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -530,7 +530,7 @@ The `check` command validates the structure of the `pyproject.toml` file and returns a detailed report if there are any errors. {{% note %}} -This command is also available as a `pre-commit` hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-check) for more information. +This command is also available as a pre-commit hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-check) for more information. {{% /note %}} ```bash From bd4123203ff896524c4133b38ea86f8f923b0e5a Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:09:27 +0100 Subject: [PATCH 24/28] Update docs/pre-commit-hooks.md Co-authored-by: Bjorn Neergaard --- docs/pre-commit-hooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index 05aa965a921..8d61f34f804 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -11,8 +11,8 @@ menu: # pre-commit hooks -`pre-commit` is a tool which manages running of -[git hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) scripts. +pre-commit is a framework for building and running +[git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). See the official documentation for more information: [pre-commit.com](https://pre-commit.com/) This document provides a list of available pre-commit hooks provided by Poetry. From 847d95b9f765a557919fe71f44429c40a00c4353 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:10:03 +0100 Subject: [PATCH 25/28] Update docs/cli.md Co-authored-by: Bjorn Neergaard --- docs/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cli.md b/docs/cli.md index d35231a9960..63e10586bc8 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -551,7 +551,7 @@ This command locks (without installing) the dependencies specified in `pyproject {{% note %}} By default, this will lock all dependencies to the latest available compatible versions. To only refresh the lock file, use the `--no-update` option. -This command is also available as a `pre-commit` hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-lock) for more information. +This command is also available as a pre-commit hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-lock) for more information. {{% /note %}} ```bash From 01696dba228e6014f533aa948a131317f48f3317 Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:10:17 +0100 Subject: [PATCH 26/28] Update docs/cli.md Co-authored-by: Bjorn Neergaard --- docs/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cli.md b/docs/cli.md index 63e10586bc8..3aba477d20e 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -600,7 +600,7 @@ poetry export -f requirements.txt --output requirements.txt {{% note %}} Only the `requirements.txt` format is currently supported. -This command is also available as a `pre-commit` hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-export) for more information. +This command is also available as a pre-commit hook. See [pre-commit hooks](/docs/pre-commit-hooks#poetry-export) for more information. {{% /note %}} ### Options From e9816c3c53d561e1033b7ba19f6d8a03ba89e14e Mon Sep 17 00:00:00 2001 From: Christian Riedel Date: Mon, 29 Nov 2021 10:10:55 +0100 Subject: [PATCH 27/28] Update docs/pre-commit-hooks.md Co-authored-by: Bjorn Neergaard --- docs/pre-commit-hooks.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index 8d61f34f804..b28324d9cfe 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -19,9 +19,9 @@ This document provides a list of available pre-commit hooks provided by Poetry. {{% note %}} -If you specify the `args:` section for a hook in your pre-commit config -the default `args:` are overwritten. So if you want to add arguments -you need to specify the default ones in your config also. +If you specify the `args:` for a hook in your `.pre-commit-config.yaml`, +the defaults are overwritten. You must fully specify all arguments for +your hook if you make use of `args:`. {{% /note %}} From 015243917db5296589f154b5abc1eb7bff7c3ce3 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Mon, 29 Nov 2021 07:38:30 -0700 Subject: [PATCH 28/28] Update docs/pre-commit-hooks.md --- docs/pre-commit-hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pre-commit-hooks.md b/docs/pre-commit-hooks.md index b28324d9cfe..c5de4f0c4fb 100644 --- a/docs/pre-commit-hooks.md +++ b/docs/pre-commit-hooks.md @@ -74,7 +74,7 @@ hooks: verbose: true ``` -Or to put the `dev` dependencies into the `requirements.txt` also use this: +Also, `--dev` can be added to `args` to write dev-dependencies to `requirements.txt`: ```yaml hooks: