AcademySoftwareFoundation / AcademySoftwareFoundation/rez

[Feature] Support for correct pre-release version sorting

未关闭
#653 8 条评论 6 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement rez-pip
主要语言
Python
星标
1.1k
派生
374
平均合并
9 天 12 小时
30 天内合并 PR
5

描述

Both PEP 440 versions and SemVar 2.0 versions may contain pre-release (and other) version information besides just maj/min/patch.

- https://www.python.org/dev/peps/pep-0440/
- https://semver.org/

Both PEP 440 and SemVar 2.0 utilize different sorting behavior for pre-releases than the default alphanumeric sort used by rez. For example, this is the expected sort order under PEP 440:

- `1.0.0-a1`
- `1.0.0b1`
- `1.0.0.rc1`
- `1.0.0`

The default rez sort will sort them like this, with the base version *before* the pre-releases, and also doesn't support the pre-release separator being optional:

- `1.0.0`
- `1.0.0-a1`
- `1.0.0.rc1`
- `1.0.0b1`

To maintain backwards compatibility, a config option could be added to enable support for this sorting behavior -- maybe `use_pep440_versioning`? With the expectation that if the package version isn't a valid PEP 440 version, it simply falls back to the normal alphanumeric sorting behavior.

This also raises another question of whether the `version` module should be vendored or not and instead be moved into rez proper, since it's already a pretty significant fork from the original and if we want it to be config aware, it should probably be moved into rez.

It may make sense to separate this ticket (and the config option) into two different options -- one for PEP 440 and one for SemVar 2.0, since they are different enough that someone may want one behavior and not the other. For this ticket, I'm mainly concerned with PEP 440 style versioning. I included SemVar 2.0 just to show it's not an issue unique to python packaging.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先检查现有的 vendored 版本模块,以及 Rez 当前用于版本排序和配置的路径。将当前行为与 PEP 440 示例进行比较,然后定义配置范围,并验证有效的 PEP 440 版本能够正确排序,而无效版本保留现有的字母数字回退机制。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。