麻线上传区收到错误消息“是版本的无效值”

时间:2019-09-12 17:48:38

标签: python python-3.x twine

我正在尝试使用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。我不明白发生了什么。

我创建了notetade标签,等等。 我想我已经创建了标签。

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

我注意到sdist命令返回错误:

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/*

这是缠绕命令的结果:

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标签。

1 个答案:

答案 0 :(得分:1)

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

  

许多构建工具与Git和Mercurial等分布式版本控制系统集成,以便向版本标识符添加标识哈希。由于无法可靠地订购哈希,因此在公共版本字段中不允许使用此类版本。