PyPi 正在版本名称的开头和结尾添加破折号 "-"



我正在尝试将我的包上传到 PyPI 上,但它不起作用。 看起来PyPisetuptools在我的版本名称前后添加了-。 最初,我有以下版本:ß-2018.8但我认为 unicode 字符不起作用。 然后我把它移到beta-2018.8但这也不起作用。 我什至尝试了一个基本的2018.8但仍然有同样的错误?!

谁能帮我弄清楚发生了什么?

我的点子版本:

pip 18.0 from /Users/mu/anaconda/envs/py3_clone/lib/python3.6/site-packages/pip (python 3.6)

我的命令:

python setup.py register sdist upload

我的错误:

Submitting dist/thisismypackagename--2018.08-.tar.gz to 
https://upload.pypi.org/legacy/
Upload failed (400): '-2018.08-' 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
error: Upload failed (400): '-2018.08-' 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

我的__init__.py

# =======
# Version
# =======
__version__="beta-2018.08"

我的setup.py

import re
from setuptools import setup
# Version
version = None
with open("./thisismypackagename/__init__.py", "r") as f:
for line in f.readlines():
line = line.strip()
if line.startswith("__version__"):
version = line.split("=")[-1].strip()
setup(name='thisismypackagename',
version=version,
description='package description',
author='Josh L. Espinoza',
packages=["thisismypackagename"],
zip_safe=False)

这是我的目录结构:

thisismypackagename
| thisismypackagename
| thisismypackagename | __init__.py
| setup.py

这是因为版本两边的双引号:

version = None
with open("./thisismypackagename/__init__.py", "r") as f:
for line in f.readlines():
line = line.strip()
if line.startswith("__version__"):
version = line.split("=")[-1].strip()
print version
# "beta-2018.08"

PyPI正在用双引号代替破折号。摆脱双引号并解决问题:

version = line.split("=")[-1].strip().strip('"')

相关内容

  • 没有找到相关文章

最新更新