-
Notifications
You must be signed in to change notification settings - Fork 983
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
Odd rendering of author when using PEP 621 metadata. #9400
Comments
I could be wrong, but I wonder if this would be on PyPI or on the tool you used for uploading (twine, or poetry, or...). I'm trying to investigate, but I can't say for sure as of now. |
Hm, the definition of the metadata value seems in PEP-0345 et. al. seems to indicate that this should be supported. I can't find the PEP that defines the upload format but I think you're right. |
I've tried looking at what it would mean on the code side, I should have known, really, but the author/author-email situation is a mess and the hole thing is probably a can of worms :D I can make it so that the base case of PEP 621 is handled, but there's quite a few examples for which I have no idea what should be returned.
This is what we do today:
This is what the PEP says:
It's hinted here and there that multiple comma-separated authors are fine in the Author field. This really makes me want to no try and parse anything smarter than the bare bare minimum :D |
I think the PEP is wrong. If both @brettcannon I think you might have written this? Any thoughts here? |
Rereading the whole thing I guess we could do the following:
Would that work ? |
It would probably work, but why should we be mangling two separate fields into one just to have to un-mangle it somewhere else? I don't see any advantage to it, and think it would be simpler to just change the PEP and the few tools (single tool?) that have already implemented it instead. |
Ah, but then we'll never be able to have proper |
I'm not sure I follow, we have proper |
If you mean what's in the metadata spec, that's how it's always been, i.e. I didn't do it 😉 . PEP 621 just went with what was there and purposefully didn't touch the metadata spec (I tried to clean it up and got push-back from trying to do too much). As for why PEP 621 uses |
I'm not sure the original metadata spec allows multiple comma-separated values to be in |
It does. From https://packaging.python.org/specifications/core-metadata/#author-email:
So my reading of "a string containing an author's emails address ... can contain a name and e-mail address" combined with "this field may contain multiple comma-separate e-mail addresses" is what led me to do what I did for PEP 621. To be clear, I personally don't care if a change is made in regards to this; I'm not trying to specifically defend how PEP 621 does things as how things should continue to be done; I'm just trying to explain the logic of how it ended up the way it did. But it seems any change will require an update to the metadata spec and PEP 621 if you want to restrict what's valid for the author- and maintainer-related metadata fields. |
There is already one moment during release submission where we have assigned a variable containing the "name" part of the multi-email RFC-822 encoded string. So without a lot of additional complexity, just assigning this to the "Author" field of the release in case it's not already filled would probably be enough. |
Any update on this? |
hi all - just a note that i'm having this issue too with test pipy for my package stravalib and i also see the same issue with sourmash on pypi. i don't think its the build back end in this case. my META from my wheel thanks to @pradyunsg for telling me how to check this is:
it seems like it's being parsed incorrect by pypi ?? many thanks for your work on pypi btw! |
FWIW, the TOML in pyproject.toml relevant to the above was (built with setuptools): maintainers = [
{name = "Leah Wasser", email = "leah@pyopensci.org"},
{name = "Hans Lellelid", email = "hans@xmpl.org"},
{name = "Jonatan Smoocha"},
{name = "Yihong"},
] x-ref stravalib/stravalib#304 |
oh yes - i'll reference this issue in my pr as well. for now i've removed emails. |
So do we think the conversion from TOML -> metadata wrong, or is PyPI's interpretation of the metadata wrong? What were you expecting to happen here? |
I think it's on PyPI's end -- wherein it's only presenting the I think the pyproject.toml's |
That's an excellent question -- I'd like to ask @lwasser to provide her thoughts on this. How would you have expect PyPI to present the information you added to maintainers = [
{name = "Leah Wasser", email = "leah@pyopensci.org"},
{name = "Hans Lellelid", email = "hans@xmpl.org"},
{name = "Jonatan Smoocha"},
{name = "Yihong"},
] One approach that I can think of is to not provide a single link to write an email to all authors/maintainers, and to instead split the keys on |
Given that maintainers rarely follow that guidance 😉, I think we still need to maintain some backwards compatibility with the expectation that |
Hence the suggestion of keeping the current behaviour when there's only one email + one name. 😉 |
absolutely @di @pradyunsg in my table here: maintainers = [
{name = "Name One", email = "nameone@email.org"},
{name = "Name Two", email = "nametwo@email.org"},
{name = "Name Three"},
{name = "Name Four"},
] i'm specifying 4 maintainers. Thus on pypi, it would render as follows <a href="mailto:nameone@email.org">Name One</a>, <a href="mailto:nametwo@email.org">Name Two</a>, Name Three, Name Four But instead it seems to do this: <a href="mailto:name one <nameone@email.org>, name one <nameone@email.org>">Name Three</a>, <a href="name one <nameone@email.org>, name one <nameone@email.org>">Name Four</a> I guess i would expect it to
|
Sorry, missed this in the edit I think. So what should happen with:
I don't think that suggestion maps well onto maintaining existing behavior. |
Just fyi if those are in the same entry/table then that wouldn't occur per PEP 621 pypa/packaging.python.org#1134 (comment) |
If you are parsing 2 entries represented like this (i'm using setuptools to bld):
you get this (2 unique humans are maintainers:
if you do this:
you get this:
Two name + email, one name only, one email only
Results in this:
I suspect two things are happening: If you have
<p><strong>Maintainer:</strong> <a href="mailto:Luiz Irber <luiz@sourmash.bio>, "C. Titus Brown" <titus@idyll.org>">Luiz Irber <luiz@sourmash.bio>, "C. Titus Brown" <titus@idyll.org></a></p>
You end up with a pypi entry like this: I hope that is helpful. it just seems to me that things are being parsed differently depending on what combination of information is provided. |
Coming from Issue #12877 (sorry for the duplicate Issue): Paste of Issue 12877 content if useful for quick reference:👋 Hi. Our project
$ python -m pip show pyhf
Name: pyhf
Version: 0.7.1.dev43
Summary: pure-Python HistFactory implementation with tensors and autodiff
Home-page:
Author:
Author-email: Lukas Heinrich <lukas.heinrich@cern.ch>, Matthew Feickert <matthew.feickert@cern.ch>, Giordon Stark <gstark@cern.ch>
License: Apache-2.0
Location: /home/feickert/.pyenv/versions/3.10.6/envs/pyhf-dev-CPU/lib/python3.10/site-packages
Requires: click, jsonpatch, jsonschema, numpy, pyyaml, scipy, tqdm
Required-by: However, when we published this to TestPyPI to check how things looked after switching over we noticed that TestPyPI is displaying only the first author and linking their email Previously when we shoved all our names and emails into I assume that this behavior with
Would it be possible for Describe the solution you'd like Have We ( Metadata from relevant wheel$ python -m pip download --index-url https://test.pypi.org/simple/ --no-deps 'pyhf==0.7.1.dev35'
$ unzip pyhf-0.7.1.dev35-py3-none-any.whl
$ head -n 12 pyhf-0.7.1.dev35.dist-info/METADATA
Metadata-Version: 2.1
Name: pyhf
Version: 0.7.1.dev35
Summary: pure-Python HistFactory implementation with tensors and autodiff
Project-URL: Documentation, https://pyhf.readthedocs.io/
Project-URL: Homepage, https://github.com/scikit-hep/pyhf
Project-URL: Issue Tracker, https://github.com/scikit-hep/pyhf/issues
Project-URL: Release Notes, https://pyhf.readthedocs.io/en/stable/release-notes.html
Project-URL: Source Code, https://github.com/scikit-hep/pyhf
Author-email: Lukas Heinrich <lukas.heinrich@cern.ch>, Matthew Feickert <matthew.feickert@cern.ch>, Giordon Stark <gstark@cern.ch>
Maintainer-email: The Scikit-HEP admins <scikit-hep-admins@googlegroups.com>
License: Apache-2.0 AuthorsOur authors = [
{ name = "Lukas Heinrich", email = "lukas.heinrich@cern.ch" },
{ name = "Matthew Feickert", email = "matthew.feickert@cern.ch" },
{ name = "Giordon Stark", email = "gstark@cern.ch" },
] and $ python -m pip show pyhf
Name: pyhf
Version: 0.7.1.dev43
Summary: pure-Python HistFactory implementation with tensors and autodiff
Home-page:
Author:
Author-email: Lukas Heinrich <lukas.heinrich@cern.ch>, Matthew Feickert <matthew.feickert@cern.ch>, Giordon Stark <gstark@cern.ch>
License: Apache-2.0
Location: /home/feickert/.pyenv/versions/3.10.6/envs/pyhf-dev-CPU/lib/python3.10/site-packages
Requires: click, jsonpatch, jsonschema, numpy, pyyaml, scipy, tqdm
Required-by: though for our render check upload to TestPyPI we noticed that TestPyPI is displaying only the first author and linking their email with the generated HTML of <p><strong>Author:</strong> <a href="mailto:lukas.heinrich@cern.ch">Lukas Heinrich</a></p> Expectation / Desired ResultHave all of the authors have their name and emails be listed in a comma separated list according to the order they appear in the wheel metadata $ grep "Author-email" pyhf-0.7.1.dev35.dist-info/METADATA
Author-email: Lukas Heinrich <lukas.heinrich@cern.ch>, Matthew Feickert <matthew.feickert@cern.ch>, Giordon Stark <gstark@cern.ch> with generated html of <p><strong>Author:</strong> <a href="mailto:lukas.heinrich@cern.ch">Lukas Heinrich</a>, <a href="mailto:matthew.feickert@cern.ch">Matthew Feickert</a>, <a href="mailto:gstark@cern.ch">Giordon Stark</a></p> MaintainersOur maintainers = [ {name = "The Scikit-HEP admins", email = "scikit-hep-admins@googlegroups.com"} ] and the TestPyPI render is with the generated HTML of <p><strong>Maintainer:</strong> <a href="mailto:The Scikit-HEP admins <scikit-hep-admins@googlegroups.com>">The Scikit-HEP admins <scikit-hep-admins@googlegroups.com></a></p> Expectation / Desired ResultHave the maintainer name match the metadata of the wheel $ grep "Maintainer-email" pyhf-0.7.1.dev35.dist-info/METADATA
Maintainer-email: The Scikit-HEP admins <scikit-hep-admins@googlegroups.com> and be a hyperlink to the <p><strong>Maintainer:</strong> <a href="mailto:scikit-hep-admins@googlegroups.com">The Scikit-HEP admins</a></p> |
Contains a few fixes/changes related to PyPI: 1. In the project README, mention the installation method from PyPI (`pip install dockstring`) 2. Fix authors list. First, I added Miguel's name without the accents. Second, on PyPI the release listed Gregor as the author but gave Miguel's email. It looks like this is a [known issue](pypi/warehouse#9400). To fix this I removed our emails. People can figure out how to contact us if they really need it. 3. Added missing entries in the CHANGELOG. 4. Added some extra metadata to pyproject.toml, including the github homepage.
I encountered this bug today. We define four authors, where we don't have an email address for one of them. Pypi.org decided to only show one of them, specifically the author without an email address, and used the email address of a different author as the It seems to me like the core metadata specification is incompatible with the degree of freedom that PEP 621 promises. For instance, how would you separate the following two cases? (click to expand)# A PEP 621 project
[project]
# ...
authors = [
{ name = "Alice" },
{ email = "bob@example.com"},
] which would become:
and # A "classic" project
setup(
# ...
author="Bob Bobbity",
author_email="bob@example.com",
) which would become:
In the first case, you would expect the name in The gap between PEP 621 and the core metadata specification can be closed in two ways:
Authors and Maintainers to core metadata to support the data model of PEP 621 |
I don't have a particular solution other than I think it would be great for someone to write a PEP that made this bit of metadata better :) There was even a recent thread on discuss.python.org where someone else had a related issue. |
I just realised that this GitHub issue should probably be split into multiple ones. The original issue description from @domdfcoding, and the use case from @matthewfeickert, are about the case where only The case where you are specifying multiple authors and mixing between The issue of supporting a mix between email and non-email authors should be a different issue, I think. It would include the use cases reported by @lwasser and @pradyunsg, and me, (EDIT: and backwards compatibility with the existing usage brought up by @di) and would likely involve changes to the core metadata spec, PEP 621, I imagine this would take a while, so it makes sense to fix the simpler issue first and handle this more complex issue separately. |
Solving the complex case by always including names in
|
- Use SPDX license identifier. (Otherwise, PyPI tries to list the license file body) - Change license classifier to specifically reference GPLv3 (only). - Add an email for Adam Biser in `authors`, to avoid bugs in PyPI using a mix of authors with/without email. @see pypi/warehouse#9400
- Use SPDX license identifier. (Otherwise, PyPI tries to list the license file body) - Change license classifier to specifically reference GPLv3 (only). - Add an email for Adam Biser in `authors`, to avoid bugs in PyPI using a mix of authors with/without email. @see pypi/warehouse#9400
- Use SPDX license identifier. (Otherwise, PyPI tries to list the license file body) - Change license classifier to specifically reference GPLv3 (only). - Add an email for Adam Biser in `authors`, to avoid bugs in PyPI using a mix of authors with/without email. @see pypi/warehouse#9400
- Use SPDX license identifier. (Otherwise, PyPI tries to list the license file body) - Change license classifier to specifically reference GPLv3 (only). - Add an email for Adam Biser in `authors`, to avoid bugs in PyPI using a mix of authors with/without email. @see pypi/warehouse#9400
- Use SPDX license identifier. (Otherwise, PyPI tries to list the license file body) - Change license classifier to specifically reference GPLv3 (only). - Add an email for Adam Biser in `authors`, to avoid bugs in PyPI using a mix of authors with/without email. @see pypi/warehouse#9400
- Use SPDX license identifier. (Otherwise, PyPI tries to list the license file body) - Change license classifier to specifically reference GPLv3 (only). - Add an email for Adam Biser in `authors`, to avoid bugs in PyPI using a mix of authors with/without email. @see pypi/warehouse#9400
PyPI can misattribute email addresses when there are multiple authors but not all of them have emails listed. pypi/warehouse#9400 (comment)
Since pypi/warehouse#9400 and pypi/warehouse#14813 (perhaps others too) remain unresolved, let's keep our metadata simple. Incomplete metadata— i.e. the email addresses this commit removes—is the only thing worse than straight-up *incorrect* metadata. We don't want any author or maintainer names to be attached to the wrong email addresses on the published package page.
Seems that having multiple authors with emails is not supported correctly on PyPI: only the first author is rendered, and it may even have the wrong email address. See pypi/warehouse#9400 Remove it also from the maintainers just to be sure not to get the wrong assignment. Better have fewer metadata that wrong ones...
### Description There are problems between TOML -> PyPi metadata (e.g. pypi/warehouse#9400), so in our case only the first author in the author list is shown, instead of all the authors... Therefore, in this PR, I add the CAREamics team as first in the list (with the rse email), and then alphabetically the people who have contributed code. I also update the list to account for the recent LVAE push!
This seems to make sense to me; my only concern at the moment is that PyPI is displaying only the first author, rather than all the authors, in the simple case of having only an
This is exactly what issue #12877 is about, but that's been closed in favour of this issue. So does it make sense to re-open that one to cover just the "doesn't display all authors in |
Will #12877 be re-opened or has the issue been declared as a non-issue and abandoned completely? |
I re-opened it. |
Describe the bug
PEP 621 allows project metadata to be defined in
pyproject.toml
. This uses a list of dictionaries to represent the project's authors. Each dictionary contains two keys, "name" and "email".To map these fields to core metadata, PEP 621 says:
Based on that, in my build backend whey I am generating metadata that looks like:
However, on PyPI this renders in the sidebar as:
(this example from https://pypi.org/project/tox-envlist/)
It's also wrong in the JSON API:
This causes further issues with tools using the API, such as https://pypistats.org, which leaves the author field blank:
Expected behavior
Compare this with another project created using setuptools:
where the metadata is:
and the response from the JSON API:
(this example from https://pypi.org/project/domdf-python-tools)
I would have expected warehouse to parse the
Author-email
field into the name and email address, and treat them the same as if they has been defined separately inAuthor
andAuthor-email
.To Reproduce
Visible at https://pypi.org/project/tox-envlist/
See also https://pypi.org/project/flit/3.2.0/, which uses PEP 621 metadata and has the same problem but uses a different build backend.
My Platform
N/A
Additional context
The text was updated successfully, but these errors were encountered: