Skip to content

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

Closed as not planned

Description

@bwoodsend

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="author@example.com" },
]

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 <author@example.com>
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?

Activity

  1. bwoodsend commented on Aug 29, 2022

    @bwoodsend
    ContributorAuthor

    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?

  2. abravalheri commented on Aug 30, 2022

    @abravalheri
    Contributor

    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.

  3. bwoodsend commented on Aug 30, 2022

    @bwoodsend
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions