Skip to content

Conversation

@brettcannon
Copy link
Member

Closes #945

@henryiii
Copy link
Contributor

henryiii commented Oct 24, 2025

In working on pypa/pyproject-metadata#260, I've thought of a few extra checks that might make sense there, or in both places:

  • Verify no names gets listed twice (combining both fields)
  • Verify that 'spam.bacon.eggs' has 'spam' and 'spam.bacon' listed somewhere too. This is described in the PEP, but there's no all-caps SHOULD or similar for it.
  • I think any package that is listed in import-names should not have any children listed. If you have a 'spam' in import-names, then you don't need to list 'spam.bacon.eggs'? Not sure on that one, haven't implemented it.

@henryiii
Copy link
Contributor

henryiii commented Oct 24, 2025

I think this should test the empty Import-Name case - that's a very special case. It's the only place where an empty field is written; I know because I had to update the writer for pyproject-metadata to differentiate None vs. empty string to get this to write out there. Not sure where to test it though, everything.metadata just checks the ability of the email module to read it, it's not testing Metadata for example. I'm almost sure the as_rfc822 method will not write this correctly, it's a special case there too (writing an empty list as one empty element).

@henryiii
Copy link
Contributor

henryiii commented Oct 24, 2025

I've got a patch ready that adds testing and fixes both directions of the special case. Would you like me to push it directly or make a PR?

@brettcannon
Copy link
Member Author

I've got a patch ready that adds testing and fixes both directions of the special case. Would you like me to push it directly or make a PR?

Wonderful! Just push it to the PR.

@brettcannon brettcannon merged commit e83801f into pypa:main Oct 24, 2025
39 checks passed
@brettcannon
Copy link
Member Author

Thanks for the improvements, @henryiii !

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

Successfully merging this pull request may close these issues.

Support package Metadata version 2.5 (Import-Name)

3 participants