Skip to content

Commit

Permalink
fix: do not ignore local config for implicit PyPI source
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Nov 6, 2024
1 parent aba510e commit 5bb3e08
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/poetry/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ def create_package_source(
raise InvalidSourceError(
"The PyPI repository cannot be configured with a custom url."
)
return PyPiRepository(disable_cache=disable_cache, pool_size=pool_size)
return PyPiRepository(
config=config,
disable_cache=disable_cache,
pool_size=pool_size,
)

try:
url = source["url"]
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/repositories/cached_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CachedRepository(Repository, ABC):
CACHE_VERSION = parse_constraint("2.0.0")

def __init__(
self, name: str, disable_cache: bool = False, config: Config | None = None
self, name: str, *, disable_cache: bool = False, config: Config | None = None
) -> None:
super().__init__(name)
self._disable_cache = disable_cache
Expand Down
3 changes: 2 additions & 1 deletion src/poetry/repositories/http_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ def __init__(
self,
name: str,
url: str,
*,
config: Config | None = None,
disable_cache: bool = False,
pool_size: int = requests.adapters.DEFAULT_POOLSIZE,
) -> None:
super().__init__(name, disable_cache, config)
super().__init__(name, disable_cache=disable_cache, config=config)
self._url = url
if config is None:
config = Config.create()
Expand Down
9 changes: 8 additions & 1 deletion src/poetry/repositories/legacy_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,21 @@ def __init__(
self,
name: str,
url: str,
*,
config: Config | None = None,
disable_cache: bool = False,
pool_size: int = requests.adapters.DEFAULT_POOLSIZE,
) -> None:
if name == "pypi":
raise ValueError("The name [pypi] is reserved for repositories")

super().__init__(name, url.rstrip("/"), config, disable_cache, pool_size)
super().__init__(
name,
url.rstrip("/"),
config=config,
disable_cache=disable_cache,
pool_size=pool_size,
)

def package(
self, name: str, version: Version, extras: list[str] | None = None
Expand Down
7 changes: 6 additions & 1 deletion src/poetry/repositories/pypi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,25 @@
from poetry.core.constraints.version import Version
from poetry.core.constraints.version import VersionConstraint

from poetry.config.config import Config

SUPPORTED_PACKAGE_TYPES = {"sdist", "bdist_wheel"}


class PyPiRepository(HTTPRepository):
def __init__(
self,
url: str = "https://pypi.org/",
*,
config: Config | None = None,
disable_cache: bool = False,
fallback: bool = True,
pool_size: int = requests.adapters.DEFAULT_POOLSIZE,
fallback: bool = True,
) -> None:
super().__init__(
"PyPI",
url.rstrip("/") + "/simple/",
config=config,
disable_cache=disable_cache,
pool_size=pool_size,
)
Expand Down

0 comments on commit 5bb3e08

Please sign in to comment.