Skip to content

Commit

Permalink
Add dynamic and provides_extra to JSON schema (#79)
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <noreply@github.com>
  • Loading branch information
shenanigansd authored Feb 27, 2024
1 parent 1cb862e commit 8b02f30
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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" },
Expand Down
35 changes: 34 additions & 1 deletion src/letsbuilda/pypi/models/models_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from dataclasses import dataclass
from datetime import datetime
from typing import Self
from typing import Literal, Self


@dataclass(frozen=True)
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit 8b02f30

Please sign in to comment.