Add an upstream_repository field to METADATA.toml (#10487)

Closes: #10478
This commit is contained in:
Sebastian Rittau
2023-07-20 16:45:41 +02:00
committed by GitHub
parent 3a9b0c5790
commit afe18e95a9
116 changed files with 122 additions and 2 deletions

View File

@@ -120,6 +120,7 @@ class StubMetadata:
requires: Annotated[list[str], "The raw requirements as listed in METADATA.toml"]
extra_description: str | None
stub_distribution: Annotated[str, "The name under which the distribution is uploaded to PyPI"]
upstream_repository: Annotated[str, "The URL of the upstream repository"] | None
obsolete_since: Annotated[str, "A string representing a specific version"] | None
no_longer_updated: bool
uploaded_to_pypi: Annotated[bool, "Whether or not a distribution is uploaded to PyPI"]
@@ -133,6 +134,7 @@ _KNOWN_METADATA_FIELDS: Final = frozenset(
"requires",
"extra_description",
"stub_distribution",
"upstream_repository",
"obsolete_since",
"no_longer_updated",
"upload",
@@ -195,6 +197,8 @@ def read_metadata(distribution: str) -> StubMetadata:
else:
stub_distribution = f"types-{distribution}"
upstream_repository: object = data.get("upstream_repository")
assert isinstance(upstream_repository, (str, type(None)))
obsolete_since: object = data.get("obsolete_since")
assert isinstance(obsolete_since, (str, type(None)))
no_longer_updated: object = data.get("no_longer_updated", False)
@@ -219,6 +223,7 @@ def read_metadata(distribution: str) -> StubMetadata:
requires=requires,
extra_description=extra_description,
stub_distribution=stub_distribution,
upstream_repository=upstream_repository,
obsolete_since=obsolete_since,
no_longer_updated=no_longer_updated,
uploaded_to_pypi=uploaded_to_pypi,