From bb5a1a77339634a65391bca8fea120a42bd464d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20K=C3=BCderle?= Date: Mon, 4 Jul 2022 10:23:17 +0200 Subject: [PATCH 1/5] Documented the use of the "subdirectory" parameter --- docs/dependency-specification.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/dependency-specification.md b/docs/dependency-specification.md index 2feeb6e5563..80f3894f2da 100644 --- a/docs/dependency-specification.md +++ b/docs/dependency-specification.md @@ -161,6 +161,20 @@ poetry config http-basic.git-org-project username token poetry add git+https://github.com/org/project.git ``` +In cases where the package you want to install is located in a subdirectory of the VCS repo, you can use the subdirectory option: + +```toml +[tool.poetry.dependencies] +# Install a package named `subdir_package` from a folder called `subdir` within the repo +subdir_package = { git = "https://github.com/mypackage_with_subdirs.git", subdirectory = "subdir" } +``` + +When using `poetry add` to achive the same options, you can use the same URL formatting that is also supported by [pip](https://pip.pypa.io/en/stable/topics/vcs-support/#url-fragments). + +```bash +poetry add "https://github.com/mypackage_with_subdirs.git#subdirectory=subdir" +``` + {{% note %}} With Poetry 1.2 releases, the default git client used is [Dulwich](https://www.dulwich.io/). From 67bf570f558aa4ab61dbc63bffcc3547c65bca9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20K=C3=BCderle?= Date: Fri, 29 Jul 2022 12:25:44 +0200 Subject: [PATCH 2/5] Moved the subdir documentation up --- docs/dependency-specification.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/dependency-specification.md b/docs/dependency-specification.md index 80f3894f2da..1826f0c7fb7 100644 --- a/docs/dependency-specification.md +++ b/docs/dependency-specification.md @@ -145,34 +145,34 @@ flask = { git = "https://github.com/pallets/flask.git", rev = "38eb5d3b" } numpy = { git = "https://github.com/numpy/numpy.git", tag = "v0.13.2" } ``` -To use an SSH connection, for example in the case of private repositories, use the following example syntax: +In cases where the package you want to install is located in a subdirectory of the VCS repo, you can use the subdirectory option: ```toml [tool.poetry.dependencies] -requests = { git = "git@github.com:requests/requests.git" } +# Install a package named `subdir_package` from a folder called `subdir` within the repo +subdir_package = { git = "https://github.com/mypackage_with_subdirs.git", subdirectory = "subdir" } ``` -To use HTTP basic authentication with your git repositories, you can configure credentials similar to -how [repository credentials]({{< relref "repositories#configuring-credentials" >}}) are configured. +When using `poetry add` to achive the same options, you can use the same URL formatting that is also supported by [pip](https://pip.pypa.io/en/stable/topics/vcs-support/#url-fragments). ```bash -poetry config repositories.git-org-project https://github.com/org/project.git -poetry config http-basic.git-org-project username token -poetry add git+https://github.com/org/project.git +poetry add "https://github.com/mypackage_with_subdirs.git#subdirectory=subdir" ``` -In cases where the package you want to install is located in a subdirectory of the VCS repo, you can use the subdirectory option: +To use an SSH connection, for example in the case of private repositories, use the following example syntax: ```toml [tool.poetry.dependencies] -# Install a package named `subdir_package` from a folder called `subdir` within the repo -subdir_package = { git = "https://github.com/mypackage_with_subdirs.git", subdirectory = "subdir" } +requests = { git = "git@github.com:requests/requests.git" } ``` -When using `poetry add` to achive the same options, you can use the same URL formatting that is also supported by [pip](https://pip.pypa.io/en/stable/topics/vcs-support/#url-fragments). +To use HTTP basic authentication with your git repositories, you can configure credentials similar to +how [repository credentials]({{< relref "repositories#configuring-credentials" >}}) are configured. ```bash -poetry add "https://github.com/mypackage_with_subdirs.git#subdirectory=subdir" +poetry config repositories.git-org-project https://github.com/org/project.git +poetry config http-basic.git-org-project username token +poetry add git+https://github.com/org/project.git ``` {{% note %}} From a3a4d51fe81d669151124e62cdb13f67085dda08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20K=C3=BCderle?= Date: Mon, 1 Aug 2022 12:10:07 +0200 Subject: [PATCH 3/5] Update docs/dependency-specification.md Co-authored-by: Mathieu Kniewallner --- docs/dependency-specification.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dependency-specification.md b/docs/dependency-specification.md index 1826f0c7fb7..26e19e491b4 100644 --- a/docs/dependency-specification.md +++ b/docs/dependency-specification.md @@ -145,7 +145,7 @@ flask = { git = "https://github.com/pallets/flask.git", rev = "38eb5d3b" } numpy = { git = "https://github.com/numpy/numpy.git", tag = "v0.13.2" } ``` -In cases where the package you want to install is located in a subdirectory of the VCS repo, you can use the subdirectory option: +In cases where the package you want to install is located in a subdirectory of the VCS repository, you can use the `subdirectory` option, similarly to what [pip](https://pip.pypa.io/en/stable/topics/vcs-support/#url-fragments) provides: ```toml [tool.poetry.dependencies] From 763500453cda5eac41e823a61b4827f2a09bc93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20K=C3=BCderle?= Date: Mon, 1 Aug 2022 12:11:00 +0200 Subject: [PATCH 4/5] Added @mkniewallner editorial changes Co-authored-by: Mathieu Kniewallner --- docs/dependency-specification.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/dependency-specification.md b/docs/dependency-specification.md index 26e19e491b4..d716524ab8d 100644 --- a/docs/dependency-specification.md +++ b/docs/dependency-specification.md @@ -149,14 +149,14 @@ In cases where the package you want to install is located in a subdirectory of t ```toml [tool.poetry.dependencies] -# Install a package named `subdir_package` from a folder called `subdir` within the repo +# Install a package named `subdir_package` from a folder called `subdir` within the repository subdir_package = { git = "https://github.com/mypackage_with_subdirs.git", subdirectory = "subdir" } ``` -When using `poetry add` to achive the same options, you can use the same URL formatting that is also supported by [pip](https://pip.pypa.io/en/stable/topics/vcs-support/#url-fragments). +with the corresponding `add` call: ```bash -poetry add "https://github.com/mypackage_with_subdirs.git#subdirectory=subdir" +poetry add "https://github.com/myorg/mypackage_with_subdirs.git#subdirectory=subdir" ``` To use an SSH connection, for example in the case of private repositories, use the following example syntax: From 52752e7bc6a8cf1d198fb0ad27bfaf04acf5f4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20K=C3=BCderle?= Date: Tue, 2 Aug 2022 14:20:04 +0200 Subject: [PATCH 5/5] Fixed final URL Co-authored-by: Mathieu Kniewallner --- docs/dependency-specification.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/dependency-specification.md b/docs/dependency-specification.md index d716524ab8d..ed35104c8d5 100644 --- a/docs/dependency-specification.md +++ b/docs/dependency-specification.md @@ -150,7 +150,7 @@ In cases where the package you want to install is located in a subdirectory of t ```toml [tool.poetry.dependencies] # Install a package named `subdir_package` from a folder called `subdir` within the repository -subdir_package = { git = "https://github.com/mypackage_with_subdirs.git", subdirectory = "subdir" } +subdir_package = { git = "https://github.com/myorg/mypackage_with_subdirs.git", subdirectory = "subdir" } ``` with the corresponding `add` call: