Skip to content

Commit

Permalink
Update repositories.md
Browse files Browse the repository at this point in the history
Clarifies default vs secondary (see discussion in python-poetry#3855)
  • Loading branch information
jonapich committed May 13, 2022
1 parent 7fcb643 commit c530dac
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions docs/repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ when publishing a package.

### Project Configuration

These package sources maybe managed using the [`source`]({{< relref "cli#source" >}}) command for
These package sources may be managed using the [`source`]({{< relref "cli#source" >}}) command for
your project.

```bash
Expand All @@ -112,9 +112,27 @@ default = false
secondary = false
```

When a package source is defined like this, it takes precedence over [PyPI](https://pypi.org).

To ignore [PyPI](https://pypi.org) completely, use `default = true`.

To target a package source only on specific packages, use `secondary = true` on the package source, and specify the `source` when adding the dependency.
In the example below, `my-lib` will be obtained from the custom package source and `urllib3` will use the [PyPI](https://pypi.org) source.

```toml
[tool.poetry.requirements]
my-lib = { version = "*", source = "foo" }
urllib3 = "*"

[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple/"
secondary = true
```

{{% warning %}}

If package sources are defined for a project, these will take precedence over
Reminder: If package sources are defined for a project, these will take precedence over
[PyPI](https://pypi.org). If you do not want this to be the case, you should declare **all** package
sources to be [secondary](#secondary-package-sources).

Expand Down

0 comments on commit c530dac

Please sign in to comment.