From 8b02f30b14078eb9287667e14b180ea1c7ed96bd Mon Sep 17 00:00:00 2001 From: Bradley Reynolds Date: Mon, 26 Feb 2024 18:12:02 -0600 Subject: [PATCH] Add dynamic and provides_extra to JSON schema (#79) Signed-off-by: GitHub --- docs/source/changelog.rst | 3 ++ pyproject.toml | 2 +- src/letsbuilda/pypi/models/models_json.py | 35 ++++++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 13bedda..36ec150 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,6 +1,9 @@ Changelog ========= +- :release:`5.1.0 <26th February 2024>` +- :bug:`78` Add ``dynamic`` and ``provides_extra`` to JSON schema + - :release:`5.0.2 <3rd February 2024>` - :bug:`74` Remove none-check from publication_date diff --git a/pyproject.toml b/pyproject.toml index 9daa73e..885ab84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "letsbuilda-pypi" -version = "5.0.2" +version = "5.1.0" description = "A wrapper for PyPI's API and RSS feed" authors = [ { name = "Bradley Reynolds", email = "bradley.reynolds@darbia.dev" }, diff --git a/src/letsbuilda/pypi/models/models_json.py b/src/letsbuilda/pypi/models/models_json.py index d597392..2562317 100644 --- a/src/letsbuilda/pypi/models/models_json.py +++ b/src/letsbuilda/pypi/models/models_json.py @@ -2,7 +2,7 @@ from dataclasses import dataclass from datetime import datetime -from typing import Self +from typing import Literal, Self @dataclass(frozen=True) @@ -114,10 +114,43 @@ class Info: version: str yanked: bool yanked_reason: str | None + dynamic: ( + list[ + Literal[ + "Platform", + "Supported-Platform", + "Summary", + "Description", + "Description-Content-Type", + "Keywords", + "Home-page", + "Download-URL", + "Author", + "Author-email", + "Maintainer", + "Maintainer-email", + "License", + "Classifier", + "Requires-Dist", + "Requires-Python", + "Requires-External", + "Project-URL", + "Provides-Extra", + "Provides-Dist", + "Obsoletes-Dist", + ] + ] + | None + ) + provides_extra: list[str] | None @classmethod def from_dict(cls: type[Self], data: dict) -> Self: # type: ignore[type-arg] """Build an instance from a dictionary.""" + if "dynamic" not in data: + data["dynamic"] = None + if "provides_extra" not in data: + data["provides_extra"] = None return cls(**data)