From 9fe70cf6dda92bcadbdfc091a321591028053819 Mon Sep 17 00:00:00 2001 From: Hsiou-Yuan Liu Date: Thu, 27 Jul 2023 18:03:31 -0400 Subject: [PATCH 1/2] doc: add pytorch example for explicit source --- docs/repositories.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/repositories.md b/docs/repositories.md index 9ff8598e7a4..61de4b32595 100644 --- a/docs/repositories.md +++ b/docs/repositories.md @@ -275,6 +275,15 @@ poetry source add --priority=explicit foo https://foo.bar/simple/ There can be more than one explicit package source. +{{% note %}} +A real-world example where an explicit package source is useful, is for PyTorch GPU packages. + +```bash +poetry source add --priority=explicit pytorch-gpu-src https://download.pytorch.org/whl/cu118 +poetry add --source pytorch-gpu-src torch torchvision torchaudio +``` +{{% /note %}} + #### Package Source Constraint All package sources (including secondary and possibly supplemental sources) will be searched during the package lookup From 8b16de3d131a8bcf2696e61af76d945e34986485 Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Sun, 25 Feb 2024 04:13:50 +0100 Subject: [PATCH 2/2] doc: add reference to package source for add --- docs/cli.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/cli.md b/docs/cli.md index 8e7efc7a11f..30aa7f10072 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -320,6 +320,14 @@ poetry will choose a suitable one based on the available package versions. poetry add requests pendulum ``` +{{% note %}} +A package is looked up, by default, only from the [Default Package Source]({{< relref "repositories/#default-package-source" >}}). +You can modify the default source (PyPI); or add and use [Supplemental Package Sources]({{< relref "repositories/#supplemental-package-sources" >}}) +or [Explicit Package Sources]({{< relref "repositories/#explicit-package-sources" >}}). + +For more information, refer to the [Package Sources]({{< relref "repositories/#package-sources" >}}) documentation. +{{% /note %}} + You can also specify a constraint when adding a package: ```bash