Can't use twine to upload flit built package
I cannot upload usingtwine the following artifacts that were build via flit https://dist.apache.org/repos/dist/release/incubator/hamilton/1.89.0/
due to:
twine upload apache-hamilton-1.89.0-incubating* Uploading distributions to https://upload.pypi.org/legacy/ ERROR InvalidDistribution: Invalid distribution metadata: unrecognized or malformed field 'import-name'
Hypothesis
This seems to be a problem because of https://github.com/apache/hamilton/blob/main/pyproject.toml#L278-L279 which then in PKG-INFO has this entry:
Import-Name: hamilton
That I think twine is complaining about.
Note: due to apache processes I need to directly upload those artifacts...
Any pointers appreciated.
Okay it's also because I guess the build of flit I used also creates metadata 2.5? Whereas twine only knows about metadata version 2.4...
Yes, Import-Name is pretty new - PEP 794 - and this is the addition that makes the metadata version 2.5. I didn't realise twine was checking metadata in this much detail. I guess you must be using Flit from git, as I don't think I've made a release since adding Import-Name support. This is a good indicator to hold off releasing Flit until this is better supported.
Twine is actually using another package, packaging, to check the metadata, and it's this that needs to support the new field. I've opened an issue for that: https://github.com/pypa/packaging/issues/945
The change has been merged in packaging, but we still need a new release of that package to fix uploads. https://github.com/pypa/packaging/issues/950