parver icon indicating copy to clipboard operation
parver copied to clipboard

allow separator between dev and num, ie, "dev.23"

Open pmolodo opened this issue 1 year ago • 4 comments

According to the regular expression in Appendix B of the specification for Version Specifiers:

https://packaging.python.org/en/latest/specifications/version-specifiers/#appendix-parsing-version-strings-with-regular-expressionsversion-specifiers/

... a separator character ('-', '_', or '.') is allowed between the word "dev" and the optional number:

(?P<dev>                     # dev release
    [-_\.]?
    (?P<dev_l>dev)
    [-_\.]?
(?P<dev_n>[0-9]+)?
)?

Also updated tests to include such versions in test cases

Fixes https://github.com/RazerM/parver/issues/33

pmolodo avatar Jan 04 '25 00:01 pmolodo

A note on implementation - I left the attribute dev_sep unchanged, instead of changing it to dev_sep1 to be consistent with naming in other segments with two seps (ie, pre and post), as I decided to prioritize backward-compatibility rather than naming consistency.

pmolodo avatar Jan 04 '25 00:01 pmolodo

...I added another commit on another branch, that renames all the "dev_sep" to "dev_sep1", if you prefer naming consistency:

https://github.com/pmolodo/parver/commit/ec26b55f123ec1f1fb057970c79f201a7eb8cf95

pmolodo avatar Jan 04 '25 00:01 pmolodo

Well spotted in the regular expression. This is not mentioned in https://peps.python.org/pep-0440/#development-release-separators like it is for post and pre releases and we should probably update the PEP and packaging docs.

RazerM avatar Jan 27 '25 11:01 RazerM

A note on implementation - I left the attribute dev_sep unchanged, instead of changing it to dev_sep1 to be consistent with naming in other segments with two seps (ie, pre and post), as I decided to prioritize backward-compatibility rather than naming consistency.

Let's rename dev_sep to dev_sep1 but accept the old keyword argument with a deprecation warning if it is used. Likewise there should be a property for the old name which emits a deprecation warning.

RazerM avatar Jan 27 '25 11:01 RazerM

Merged as #36, thanks @pmolodo. Note I went for a breaking change in the end. It will be released as 1.0

RazerM avatar Jul 03 '25 20:07 RazerM