You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If package sources are defined for a project, these will take precedence over
123
-
[PyPI](https://pypi.org). If you do not want this to be the case, you should declare **all** package
124
-
sources to be [secondary](#secondary-package-sources).
125
-
126
-
{{% /warning %}}
127
+
Any package source not marked as `secondary` will take precedence over [PyPI](https://pypi.org).
127
128
128
-
See [Supported Package Sources](#supported-package-sources) for source type specific information.
129
129
130
130
{{% note %}}
131
131
132
-
If your package source requires [credentials](#configuring-credentials) or
133
-
[certificates](#certificates), please refer to the relevant sections below.
132
+
If you prefer to disable [PyPI](https://pypi.org) completely, you may choose to set one of your package sources to be the [default](#default-package-source).
133
+
134
+
If you prefer to specify a package source for a specific dependency, see [Secondary Package Sources](#secondary-package-sources).
134
135
135
136
{{% /note %}}
136
137
138
+
139
+
{{% warning %}}
140
+
141
+
If you do not want any of the custom sources to take precedence over [PyPI](https://pypi.org),
142
+
you must declare **all** package sources to be [secondary](#secondary-package-sources).
143
+
144
+
{{% /warning %}}
145
+
146
+
137
147
#### Default Package Source
138
148
139
149
By default, Poetry configures [PyPI](https://pypi.org) as the default package source for your
@@ -172,11 +182,21 @@ All package sources (including secondary sources) will be searched during the pa
172
182
process. These network requests will occur for all sources, regardless of if the package is
173
183
found at one or more sources.
174
184
175
-
If you wish to avoid this, you may explicitly specify which source to search in for a particular
176
-
package.
185
+
In order to limit the search for a specific package to a particular package repository, you can specify the source explicitly. This is strongly suggested for all private packages to avoid dependency confusion attacks.
177
186
178
187
```bash
179
-
poetry add --source pypi httpx
188
+
poetry add --source internal-pypi httpx
189
+
```
190
+
191
+
```toml
192
+
[tool.poetry.dependencies]
193
+
...
194
+
httpx = { version = "^0.22", source = "internal-pypi" }
0 commit comments