Skip to content

Commit 73302b3

Browse files
authored
fix: do not ignore local config for implicit PyPI source (#9816)
1 parent 4a71a8d commit 73302b3

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

src/poetry/factory.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ def create_package_source(
195195
raise InvalidSourceError(
196196
"The PyPI repository cannot be configured with a custom url."
197197
)
198-
return PyPiRepository(disable_cache=disable_cache, pool_size=pool_size)
198+
return PyPiRepository(
199+
config=config,
200+
disable_cache=disable_cache,
201+
pool_size=pool_size,
202+
)
199203

200204
try:
201205
url = source["url"]

src/poetry/repositories/cached_repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CachedRepository(Repository, ABC):
2525
CACHE_VERSION = parse_constraint("2.0.0")
2626

2727
def __init__(
28-
self, name: str, disable_cache: bool = False, config: Config | None = None
28+
self, name: str, *, disable_cache: bool = False, config: Config | None = None
2929
) -> None:
3030
super().__init__(name)
3131
self._disable_cache = disable_cache

src/poetry/repositories/http_repository.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ def __init__(
4949
self,
5050
name: str,
5151
url: str,
52+
*,
5253
config: Config | None = None,
5354
disable_cache: bool = False,
5455
pool_size: int = requests.adapters.DEFAULT_POOLSIZE,
5556
) -> None:
56-
super().__init__(name, disable_cache, config)
57+
super().__init__(name, disable_cache=disable_cache, config=config)
5758
self._url = url
5859
if config is None:
5960
config = Config.create()

src/poetry/repositories/legacy_repository.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,21 @@ def __init__(
3030
self,
3131
name: str,
3232
url: str,
33+
*,
3334
config: Config | None = None,
3435
disable_cache: bool = False,
3536
pool_size: int = requests.adapters.DEFAULT_POOLSIZE,
3637
) -> None:
3738
if name == "pypi":
3839
raise ValueError("The name [pypi] is reserved for repositories")
3940

40-
super().__init__(name, url.rstrip("/"), config, disable_cache, pool_size)
41+
super().__init__(
42+
name,
43+
url.rstrip("/"),
44+
config=config,
45+
disable_cache=disable_cache,
46+
pool_size=pool_size,
47+
)
4148

4249
def package(
4350
self, name: str, version: Version, extras: list[str] | None = None

src/poetry/repositories/pypi_repository.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,25 @@
2929
from poetry.core.constraints.version import Version
3030
from poetry.core.constraints.version import VersionConstraint
3131

32+
from poetry.config.config import Config
33+
3234
SUPPORTED_PACKAGE_TYPES = {"sdist", "bdist_wheel"}
3335

3436

3537
class PyPiRepository(HTTPRepository):
3638
def __init__(
3739
self,
3840
url: str = "https://pypi.org/",
41+
*,
42+
config: Config | None = None,
3943
disable_cache: bool = False,
40-
fallback: bool = True,
4144
pool_size: int = requests.adapters.DEFAULT_POOLSIZE,
45+
fallback: bool = True,
4246
) -> None:
4347
super().__init__(
4448
"PyPI",
4549
url.rstrip("/") + "/simple/",
50+
config=config,
4651
disable_cache=disable_cache,
4752
pool_size=pool_size,
4853
)

0 commit comments

Comments
 (0)