Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example package leads to author name being munged with author_email #1134

Closed
bwoodsend opened this issue Aug 28, 2022 · 4 comments
Closed

Example package leads to author name being munged with author_email #1134

bwoodsend opened this issue Aug 28, 2022 · 4 comments

Comments

@bwoodsend
Copy link
Contributor

Following the example package from here, in particular the method of specifier author/email it demonstrates causes pip show to get confused. An example pyproject.toml:

# pyproject.toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "test-package"
version = "0.0.1"
authors = [
  { name="Example Author", email="[email protected]" },
]

which when installed, reports the Author field as blank and the author's name + email as the email field.

> pip install -q .
> pip show test-package
Name: test-package
Version: 0.0.1
Summary: 
Home-page: 
Author: 
Author-email: Example Author <[email protected]>
License: 
Location: /usr/local/lib/python3.10/site-packages
Requires: 
Required-by: 

dict(importlib.metadata.distribution("test-package")) gives the same pattern. This happens irregardless of build backend. What is the reasoning behind this discrepancy? Is the Author field in packaging land being phased out or is this a bug somwhere?

@bwoodsend
Copy link
Contributor Author

Hmm, so Author-email includes author's name and Author includes the author's email. Why have separate fields for the two then if Author is a superset of Author-email?

@abravalheri
Copy link
Contributor

abravalheri commented Aug 30, 2022

Hatchling interprets https://packaging.python.org/en/latest/specifications/core-metadata/#author as https://github.com/pypa/hatch/blob/hatchling-v1.8.1/backend/src/hatchling/metadata/core.py#L681-L686

I believe this is also the interpretation setuptools follows.

@bwoodsend this is in accordance with the text of PEP 621:

If only name is provided, the value goes in Author/Maintainer as appropriate.

If only email is provided, the value goes in Author-email/Maintainer-email as appropriate.

If both email and name are provided, the value goes in Author-email/Maintainer-email as appropriate, with the format {name} <{email}> (with appropriate quoting, e.g. using email.headerregistry.Address).
https://peps.python.org/pep-0621/#authors-maintainers

Or would it be a different problem?

Note: According to core metadata, I belive that both Author and Author-email could be used when both pieces if information are available, but PEP 621 restricts that to Author-email.


If you disagree with the approach described in the PEP, I suggest creating a discussion in https://discuss.python.org/c/packaging/14 and possibly volunteering to write another PEP changing that.

@bwoodsend
Copy link
Contributor Author

It is indeed what the PEP says. I can't say I like it but you're right - this isn't the place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants