From cb263760a83301d5f648b8f36d71f4d04874c092 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 22 Jan 2023 11:43:36 +0000 Subject: [PATCH 1/4] Optional-dependency docs: add a self-dependency example --- docs/config/dependency.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/config/dependency.md b/docs/config/dependency.md index 79dd796b1..db50d9c5b 100644 --- a/docs/config/dependency.md +++ b/docs/config/dependency.md @@ -147,6 +147,22 @@ foo[cli,crypto]==1.* Note that the features come immediately after the package name, before any [version specifiers](#version-specifiers). +One feature group can extend another feature group by using a "self-dependency". For example, for a project called `awesome_project`, the `dev` feature group in the following `pyproject.toml` file would select everything in the `crypto` feature group, plus `black`: + +=== ":octicons-file-code-16: pyproject.toml" + + ```toml + [project.optional-dependencies] + crypto = [ + "PyJWT", + "cryptography", + ] + dev = [ + "awesome_project[crypto]", + "black" + ] + ``` + ## Direct references Instead of using normal [version specifiers](#version-specifiers) and fetching packages from an index like PyPI, you can define exact sources using [direct references](https://peps.python.org/pep-0440/#direct-references) with an explicit [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax). From 18bce45bdfc47c418ae500fc97d2952beb4d8f42 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 22 Jan 2023 11:47:45 +0000 Subject: [PATCH 2/4] nit --- docs/config/dependency.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/config/dependency.md b/docs/config/dependency.md index db50d9c5b..fe5e6b532 100644 --- a/docs/config/dependency.md +++ b/docs/config/dependency.md @@ -147,7 +147,7 @@ foo[cli,crypto]==1.* Note that the features come immediately after the package name, before any [version specifiers](#version-specifiers). -One feature group can extend another feature group by using a "self-dependency". For example, for a project called `awesome_project`, the `dev` feature group in the following `pyproject.toml` file would select everything in the `crypto` feature group, plus `black`: +One feature group can extend another feature group by using "self-dependency". For example, for a project called `awesome_project`, the `dev` feature group in the following `pyproject.toml` file would select everything in the `crypto` feature group, plus `black`: === ":octicons-file-code-16: pyproject.toml" From 9671140b072b82f4c67f1853401663107aef51f4 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 7 Feb 2023 12:31:21 +0000 Subject: [PATCH 3/4] Update docs/config/dependency.md Co-authored-by: Arseny Boykov <36469655+Bobronium@users.noreply.github.com> --- docs/config/dependency.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/config/dependency.md b/docs/config/dependency.md index fe5e6b532..ab53b308f 100644 --- a/docs/config/dependency.md +++ b/docs/config/dependency.md @@ -152,6 +152,9 @@ One feature group can extend another feature group by using "self-dependency". F === ":octicons-file-code-16: pyproject.toml" ```toml + [project] + name = "awesome_project" + [project.optional-dependencies] crypto = [ "PyJWT", From c7accfeda770ab2148b6836e98460720ecb4aebc Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 8 Feb 2023 14:46:58 +0000 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Ofek Lev --- docs/config/dependency.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/config/dependency.md b/docs/config/dependency.md index ab53b308f..0a9c1fa9c 100644 --- a/docs/config/dependency.md +++ b/docs/config/dependency.md @@ -153,7 +153,7 @@ One feature group can extend another feature group by using "self-dependency". F ```toml [project] - name = "awesome_project" + name = "awesome-project" [project.optional-dependencies] crypto = [ @@ -161,8 +161,8 @@ One feature group can extend another feature group by using "self-dependency". F "cryptography", ] dev = [ - "awesome_project[crypto]", - "black" + "awesome-project[crypto]", + "black", ] ```