麻线上传区。得到一个错误 "is an invalid value for Version"

twine upload dist. Get an error "is an invalid value for Version"

我正在尝试使用 twine upload dist/* 命令上传我的包。我得到一个错误:

Client Error: 'X.Y.ZZ.post0.dev0-g83905ac' is an invalid value for Version. Error:

在我看来 X.Y.ZZ.post0.dev0-g83905ac 版本确实满足 PEP 440。我不明白这是怎么回事。

我已经创建了 annotetade 标签等。 我想我已经创建了标签。

$ git tag -a vX.Y.ZZ  # Don't forget the leading v
fatal: tag 'vX.Y.ZZ' already exists

我注意到 sdist 命令 returns 错误:

user:package user-13$ python3 setup.py sdist
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py:483: UserWarning: The version specified ('X.Y.ZZ.post0.dev0+g83905ac') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
  "details." % self.metadata.version

我有所有的最新版本:

user:package user-13$ pip3 --version
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)
user: package femto-13$ python3 --version
Python 3.7.4
user: package femto-13$ twine --version
twine version 1.14.0 (pkginfo: 1.5.0.1, requests: 2.22.0, setuptools: 41.2.0,
requests-toolbelt: 0.9.1, tqdm: 4.35.0)

历史:

  917  git tag -a vX.Y.ZZ  # Don't forget the leading v
  918  git push origin vX.Y.ZZ
  919  python3 setup.py sdist
  920  python3 setup.py bdist_wheel
  921  twine upload dist/*

这里是 twine 命令的结果:

user:package user-13$ twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Uploading py_package-X.Y.ZZ.post0.dev0_g83905ac-py3-none-any.whl
100%|███████████████████████████████████████████████████████████████████████| 18.5k/18.5k [00:00<00:00, 37.9kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 400 Client Error: 'X.Y.ZZ.post0.dev0-g83905ac' is an invalid value for Version. Error: Start and end with a letter or numeral containing only ASCII numeric and '.', '_' and '-'. See https://packaging.python.org/specifications/core-metadata for url: https://upload.pypi.org/legacy/

我已将标签更新为 0.0.1 并删除了所有 X.Y.Z 标签。

版本 X.Y.ZZ.post0.dev0-g83905ac 不是 PyPI 的有效版本号。它包含一个提交哈希 g83905ac,并且 PEP 440 表示:

Many build tools integrate with distributed version control systems like Git and Mercurial in order to add an identifying hash to the version identifier. As hashes cannot be ordered reliably such versions are not permitted in the public version field.