Skip to content

Commit

Permalink
Change email-related fields in Metadata to str (pypa#596)
Browse files Browse the repository at this point in the history
Otherwise not all valid metadata can be properly represented by `Metadata` due to the amount of flexibility allowed by RFC-822.
  • Loading branch information
brettcannon authored and KOLANICH committed Nov 30, 2022
1 parent 6cba355 commit d82f564
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions packaging/metadata.py
Expand Up @@ -7,7 +7,6 @@
from .version import Version

# Type aliases.
_NameAndEmail = Tuple[Optional[str], str]
_LabelAndURL = Tuple[str, str]


Expand Down Expand Up @@ -75,13 +74,13 @@ class Metadata:
keywords: List[str]
home_page: str
author: str
author_emails: List[_NameAndEmail]
author_email: str
license: str
supported_platforms: List[str]
download_url: str
classifiers: List[str]
maintainer: str
maintainer_emails: List[_NameAndEmail]
maintainer_email: str
requires_dists: List[Requirement]
requires_python: SpecifierSet
requires_externals: List[str]
Expand All @@ -104,15 +103,15 @@ def __init__(
keywords: Optional[Iterable[str]] = None,
home_page: Optional[str] = None,
author: Optional[str] = None,
author_emails: Optional[Iterable[_NameAndEmail]] = None,
author_email: Optional[str] = None,
license: Optional[str] = None,
# 1.1
supported_platforms: Optional[Iterable[str]] = None,
download_url: Optional[str] = None,
classifiers: Optional[Iterable[str]] = None,
# 1.2
maintainer: Optional[str] = None,
maintainer_emails: Optional[Iterable[_NameAndEmail]] = None,
maintainer_email: Optional[str] = None,
requires_dists: Optional[Iterable[Requirement]] = None,
requires_python: Optional[SpecifierSet] = None,
requires_externals: Optional[Iterable[str]] = None,
Expand All @@ -137,17 +136,13 @@ def __init__(
:param keywords: ``Keywords``
:param home_page: ``Home-Page``
:param author: ``Author``
:param author_emails:
``Author-Email`` (two-item tuple represents the name and email of the
author)
:param author_email: ``Author-Email``
:param license: ``License``
:param supported_platforms: ``Supported-Platform``
:param download_url: ``Download-URL``
:param classifiers: ``Classifier``
:param maintainer: ``Maintainer``
:param maintainer_emails:
``Maintainer-Email`` (two-item tuple represent the name and email of the
maintainer)
:param maintainer_email: ``Maintainer-Email``
:param requires_dists: ``Requires-Dist``
:param SpecifierSet requires_python: ``Requires-Python``
:param requires_externals: ``Requires-External``
Expand All @@ -166,13 +161,13 @@ def __init__(
self.keywords = list(keywords or [])
self.home_page = home_page or ""
self.author = author or ""
self.author_emails = list(author_emails or [])
self.author_emails = author_email or ""
self.license = license or ""
self.supported_platforms = list(supported_platforms or [])
self.download_url = download_url or ""
self.classifiers = list(classifiers or [])
self.maintainer = maintainer or ""
self.maintainer_emails = list(maintainer_emails or [])
self.maintainer_emails = maintainer_email or ""
self.requires_dists = list(requires_dists or [])
self.requires_python = requires_python or SpecifierSet()
self.requires_externals = list(requires_externals or [])
Expand Down

0 comments on commit d82f564

Please sign in to comment.