错误
/root/.local/lib/python3.7/site-packages/setuptools/dist.py:476: UserWarning: Normalizing '2.1.0c1' to '2.1.0rc1'
normalized_version,
[Pipeline] sh
+ python3 -m twine upload --config-file .pypirc -r nesus dist/forecasting_model-2.1.0c1.tar.gz
InvalidDistribution: Cannot find file (or expand pattern): 'dist/forecasting_model-2.1.0c1.tar.gz'
我的命名约定代码
model_version_trunc = re.split("a|b|c", current_version)[0] if len(re.split("a|b|c", current_version)) > 0 else current_version
sub_version = int(re.split("a|b|c", current_version)[1]) if len(re.split("a|b|c", current_version)) > 1 else 1
VERSION = current_version
if BRANCH == 'workbench':
letter = 'a'
elif BRANCH == 'development':
letter = 'b'
elif BRANCH == 'master':
sub_version = ''
letter = ''
else:
letter = 'c'
VERSION = f'{model_version_trunc}{letter}{sub_version}'
# Check Version
session = HTMLSession()
r = session.get(MODEL_LIBRARY)
versions_so_far = r.html.links
version_already_exists = list(set([f'{VERSION}/']).intersection(versions_so_far))
logger.info(f'Updated Version: {VERSION}')
logger.info(f'Version Exists: {version_already_exists}')
if len(version_already_exists) > 0:
for x in version_already_exists:
'''
Fallback if versions are similar:
If a version is an alpha/beta/branch release, update the release number
If a version is just the standard version then udpate the minor version.
'''
我检查了这里的链接 -
流行的命名约定。
有没有办法修复这种感觉!
最佳答案
您的版本方案与 PEP 440 不兼容。您在问题中提到的链接明确指出:
Different Python projects may use different versioning schemes based on the needs of that particular project, but all of them are required to comply with the flexible public version scheme specified in PEP 440 in order to be supported in tools and libraries like
pip
andsetuptools
.
PEP 440 只允许使用五个后缀:a
、b
、rc
、post
和 dev
.
另请注意,a
和 b
后缀标识 alpha 和 beta 版本,因此请检查您的版本控制方案是否反射(reflect)了这一点(workbench
分支是否反射(reflect)了这一点)真的包含 alpha 版本吗?)。
如果需要在版本中存储附加信息,可以使用local version identifier分隔版本部分。示例:
1.2.3+spam
1.0.0.dev999+eggs123.bacon456
但是,再次重申 PEP 440:
Local version identifiers SHOULD NOT be used when publishing upstream projects to a public index server, but MAY be used to identify private builds created directly from the project source. [...] As the Python Package Index is intended solely for indexing and hosting upstream projects, it MUST NOT allow the use of local version identifiers.
关于Python 安装工具根据通用命名约定规范版本名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60323764/