我应该如何设置发布之间的版本号?

2024-09-27 18:06:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个关于GitHub(ModelicaRes)的Python项目。我试着跟着Semantic Versioning。我发布主项目站点的发布并上传到PyPI。{u{I>释放版本号{。在发布之间,我会将更新推送到GitHub(通常在主分支上——没什么特别的)。在

如何设置这些版本间更新的版本号?提交通常是工作副本。它们还没有完全测试,但其他人可能会下载并使用这些副本(通过GitHub)。通常,我还没准备好确定新版本号。最近,我将版本号设置为None,并将自动生成的"UNRELEASED COPY" file放入基本文件夹中,其中包含提交日期和其他信息。然而,我不相信这是最好的方法。在

这可能适用于其他语言,但现在我只对Python感兴趣。在

我想我可以尝试在下一个版本号上使用一个“alpha”、“beta”或“rc”后缀,但我也不总是知道下一个版本号(可能是主要版本或次要版本,也可能是错误修复)。我还想保持这个简单——不要太多分支,等等

谢谢!在


Tags: 项目版本githubpypinone站点版本号分支
3条回答

如果你推送的代码不是“发布的”,你就没有遵循语义版本控制。对于SemVer,每个更新都是一个版本:对于新的向后兼容功能,要么是次要版本-2.1.0;对于bug修复,要么是补丁-2.1.1。在

关于Python包/发行版版本控制的当前建议摘要见Python Packaging User Guide here

1.2.0.dev1  # Development release
1.2.0a1     # Alpha Release
1.2.0b1     # Beta Release
1.2.0rc1    # Release Candidate
1.2.0       # Final Release
1.2.0.post1 # Post Release
15.10       # Date based release
23          # Serial release

遵循draft PEP 440的建议。在

Daniel不太正确:Semantic versioning确实支持预发布(emphasis mine):

(11) Precedence refers to how versions are compared to each other when ordered. Precedence MUST be calculated by separating the version into major, minor, patch and pre-release identifiers in that order (Build metadata does not figure into precedence). Precedence is determined by the first difference when comparing each of these identifiers from left to right as follows: Major, minor, and patch versions are always compared numerically. Example: 1.0.0 < 2.0.0 < 2.1.0 < 2.1.1. When major, minor, and patch are equal, a pre-release version has lower precedence than a normal version. Example: 1.0.0-alpha < 1.0.0. Precedence for two pre-release versions with the same major, minor, and patch version MUST be determined by comparing each dot separated identifier from left to right until a difference is found as follows: identifiers consisting of only digits are compared numerically and identifiers with letters or hyphens are compared lexically in ASCII sort order. Numeric identifiers always have lower precedence than non-numeric identifiers. A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal. Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.

相关问题 更多 >

    热门问题