From 1932dda16762e7df69852504a27730b7e8beda96 Mon Sep 17 00:00:00 2001 From: David Hotham Date: Sat, 2 Mar 2024 13:29:47 +0000 Subject: [PATCH] metadata version 2.3 --- src/poetry/core/masonry/builders/builder.py | 2 +- src/poetry/core/masonry/metadata.py | 6 ++++-- tests/masonry/builders/test_builder.py | 2 +- tests/masonry/builders/test_complete.py | 2 +- tests/masonry/test_api.py | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/poetry/core/masonry/builders/builder.py b/src/poetry/core/masonry/builders/builder.py index dab3cc2da..38612ff52 100644 --- a/src/poetry/core/masonry/builders/builder.py +++ b/src/poetry/core/masonry/builders/builder.py @@ -21,7 +21,7 @@ ) METADATA_BASE = """\ -Metadata-Version: 2.1 +Metadata-Version: 2.3 Name: {name} Version: {version} Summary: {summary} diff --git a/src/poetry/core/masonry/metadata.py b/src/poetry/core/masonry/metadata.py index 9670cb126..0c18c1051 100644 --- a/src/poetry/core/masonry/metadata.py +++ b/src/poetry/core/masonry/metadata.py @@ -6,11 +6,13 @@ if TYPE_CHECKING: + from packaging.utils import NormalizedName + from poetry.core.packages.package import Package class Metadata: - metadata_version = "2.1" + metadata_version = "2.3" # version 1.0 name: str | None = None version: str @@ -41,7 +43,7 @@ class Metadata: # Version 2.1 description_content_type: str | None = None - provides_extra: list[str] = [] # noqa: RUF012 + provides_extra: list[NormalizedName] = [] # noqa: RUF012 @classmethod def from_package(cls, package: Package) -> Metadata: diff --git a/tests/masonry/builders/test_builder.py b/tests/masonry/builders/test_builder.py index 2bea1fa6c..f01325d7e 100644 --- a/tests/masonry/builders/test_builder.py +++ b/tests/masonry/builders/test_builder.py @@ -92,7 +92,7 @@ def test_get_metadata_content() -> None: p = Parser() parsed = p.parsestr(metadata) - assert parsed["Metadata-Version"] == "2.1" + assert parsed["Metadata-Version"] == "2.3" assert parsed["Name"] == "my-package" assert parsed["Version"] == "1.2.3" assert parsed["Summary"] == "Some description." diff --git a/tests/masonry/builders/test_complete.py b/tests/masonry/builders/test_complete.py index 649e196a5..46bb9fd54 100644 --- a/tests/masonry/builders/test_complete.py +++ b/tests/masonry/builders/test_complete.py @@ -181,7 +181,7 @@ def test_complete(no_vcs: bool) -> None: assert ( wheel_data == """\ -Metadata-Version: 2.1 +Metadata-Version: 2.3 Name: my-package Version: 1.2.3 Summary: Some description. diff --git a/tests/masonry/test_api.py b/tests/masonry/test_api.py index 04024ba69..3614f30f9 100644 --- a/tests/masonry/test_api.py +++ b/tests/masonry/test_api.py @@ -151,7 +151,7 @@ def test_prepare_metadata_for_build_wheel() -> None: Tag: py3-none-any """ metadata = """\ -Metadata-Version: 2.1 +Metadata-Version: 2.3 Name: my-package Version: 1.2.3 Summary: Some description.