Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not ignore local config for implicit PyPI source #9816

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading