Description
Your Environment
- Your operating system:
N/A
- Version of python you are running:
N/A
- How did you install twine? Did you use your operating system's package manager or pip or something else?
pip
- Version of twine you have installed (include complete output of):
twine --version
twine==1.12.1
- Which package repository are you targeting?
Metadata:
Metadata-Version: 2.1
Name: ansible-lint
Version: 3.5.2.dev35+gaa91980
The Issue
I'm involved with https://github.com/ansible/ansible-lint packaging.
We're using setuptools-scm plugin to identify the current version of the distribution, then used in its metadata.
I've configured Travis CI to have one job continuously deploying to Test PyPI. This helps us to keep this whole PyPI automation healthy at all times.
Except that it fails.
setuptools-scm
generates PEP440-compliant version based on the previous tag and the current commit: 3.5.2.dev35+gaa91980
(where 35 is the distance to tag 3.5.1 and gaa91980 is sha1 of the current commit. +gaa91980
is a local version identifier.
Up until today I didn't know that public indexes are discouraged from accepting dists with a version containing local identifier:
As the Python Package Index is intended solely for indexing and hosting upstream projects, it MUST NOT allow the use of local version identifiers.
Warehouse respects this: https://github.com/pypa/warehouse/blob/27ed636/warehouse/forklift/legacy.py#L190.
And responds with HTTPError: 400 Client Error: '3.5.2.dev35+gaa91980' is an invalid value for Version. Error: Can't use PEP 440 local versions. See https://packaging.python.org/specifications/core-metadata for url: https://test.pypi.org/legacy/
:
https://travis-ci.com/ansible/ansible-lint/jobs/163591117#L1095
So what twine
has to do with all of this?
I think twine check
should have some --strict
option or so and do those same checks warehouse does in order to inform users about potential problems with metadata happening on the PyPI side and produce a more user-friendly explanation of what's happening.