-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Right now this check fails when a dependency is in a optional group:
def verify_external_req_stubs_require_its_runtime(
req: Requirement, upstream_distribution: str | None
) -> None:
"""Verify that an external stubs package requires its runtime package."""
if upstream_distribution is None:
raise InvalidRequires(
f"There is no upstream distribution on PyPI, so cannot verify {req}"
)
resp = requests.get(f"https://pypi.org/pypi/{upstream_distribution}/json")
validate_pypi_response(resp, req)
data: dict[str, Any] = resp.json()
# TODO: PyPI doesn't seem to have version specific requires_dist. This does mean we can be
# broken by new releases of upstream packages, even if they do not match the version spec we
# have for the upstream distribution.
if not (
req.name == upstream_distribution # Allow `types-foo` to require `foo`
or runtime_in_upstream_requires(req, data)
or runtime_in_upstream_sdist_requires(req, data)
):
runtime_req_name = EXTERNAL_RUNTIME_REQ_MAP.get(req.name, req.name)
> raise InvalidRequires(
f"Expected dependency {runtime_req_name} to be listed in {upstream_distribution}'s "
+ "requires_dist or the sdist's *.egg-info/requires.txt"
)
E stub_uploader.metadata.InvalidRequires: Expected dependency httpx to be listed in Authlib's requires_dist or the sdist's *.egg-info/requires.txt
This happens because httpx
is not a direct dependency of Authlib
, but it is an optional one: https://github.com/authlib/authlib/blob/06015d20652a23eff8350b6ad71b32fe41dae4ba/pyproject.toml#L63
I think that this should be supported. I propose to add one more check: runtime_in_upstream_group_requires
Metadata
Metadata
Assignees
Labels
No labels