ITADN

Support `[dependency-groups]`

#190Closedsobolevn 创建于 2025-10-06
S
sobolevncommented
Right now this check fails when a dependency is in a optional group: ```python 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` Refs https://github.com/python/typeshed/pull/14800
关闭于 2026-01-23 2 条评论