I'm trying to build my PyPi package and after I ran this command python3 -m twine upload --verbose --repository testpypi dist/*
it gave me this error:
Response from https://test.pypi.org/legacy/:
400 '0+untagged.2.g592d0aa' is an invalid value for Version. Error: Can't use PEP 440 local versions. See https://packaging.python.org/specifications/core-metadata for more information.
INFO <html>
<head>
<title>400 '0+untagged.2.g592d0aa' is an invalid value for Version. Error: Can't use PEP 440 local versions. See https://packaging.python.org/specifications/core-metadata for more information.</title>
</head>
<body>
<h1>400 '0+untagged.2.g592d0aa' is an invalid value for Version. Error: Can't use PEP 440 local versions. See https://packaging.python.org/specifications/core-metadata for more information.</h1>
The server could not comply with the request since it is either malformed or otherwise incorrect.<br/><br/>
'0+untagged.2.g592d0aa' is an invalid value for Version. Error: Can't use PEP 440 local versions. See https://packaging.python.org/specifications/core-metadata for more information.
</body>
</html>
ERROR HTTPError: 400 Bad Request from https://test.pypi.org/legacy/
'0+untagged.2.g592d0aa' is an invalid value for Version. Error: Can't use PEP 440 local versions. See https://packaging.python.org/specifications/core-metadata for more information.
I used --verbose
to get more information about my error. For my setup.py I used the following for version:
setup(
name='fsa_test_one',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass()
The issue was in the versioneer
style, it is found in the setup.cfg
file I changed that to the style that supports my package which is PEP440-pre
. So after changing that I had to setup versioneer again and then it worked. I also had to make sure I removed all the previous builds stored in the dist/*
directory