Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pmolodo
Copy link

@pmolodo pmolodo commented Jan 4, 2025

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 #33

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 RazerM#33
@pmolodo pmolodo force-pushed the pr/dev-separator-number-fix branch from 2c43655 to 1308b23 Compare January 4, 2025 00:36
@pmolodo
Copy link
Author

pmolodo commented Jan 4, 2025

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
Copy link
Author

pmolodo commented Jan 4, 2025

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

pmolodo@ec26b55

@RazerM
Copy link
Owner

RazerM commented Jan 27, 2025

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
Copy link
Owner

RazerM commented Jan 27, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separator between "dev" and number not allowed
2 participants