Skip to content

Epoch versions #208

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

Closed
wenkokke opened this issue May 17, 2023 · 9 comments
Closed

Epoch versions #208

wenkokke opened this issue May 17, 2023 · 9 comments

Comments

@wenkokke
Copy link

wenkokke commented May 17, 2023

BumpVer does not handle epoch versions correctly.

Aside from the fact that there is no EPOCH matcher, the follow configuration produces the wrong PEP440 version:

current_version = "1!2.1.5"
version_pattern = "1!MAJOR.MINOR.PATCH"

This results in the PEP440 version 12.1.5 instead of 1!2.1.5.

@mbarkhau
Copy link
Owner

Pardon, do you have a link for me, what the semantics of EPOCH are?

@wenkokke
Copy link
Author

wenkokke commented May 17, 2023

Pardon, do you have a link for me, what the semantics of EPOCH are?

See version epochs in PEP 440:
https://peps.python.org/pep-0440/#version-epochs

For my purposes, the issue is that BumpVer shouldn’t discard the ! in the version when converting to the PEP 440 version.

In terms of EPOCH as a BumpVer pattern, I guess it’d just be another pattern like MAJOR and MINOR. However, it’s unlikely that I’d want to automatically bump into a different epoch, since the semantics of that are changing the versioning scheme, which shouldn’t be a common occurrence.

@mbarkhau
Copy link
Owner

Hmm, regardless of support for EPOCH, the current behaviour doesn't seem appropriate. I'll investigate further.

If we do add support for EPOCH I think we can add support analogously to MAJOR. I'm in favour of this, regardless of how common/seldom it is used.

@mbarkhau
Copy link
Owner

I can't quite reproduce the behaviour you're describing, when I use the test command:

$ bumpver test '1!2.1.5-alpha' '1!MAJOR.MINOR.PATCH[-TAG]' --patch
New Version: 1!2.1.6-alpha
PEP440     : 1!2.1.6a0

Is there some more info you can provide?

@wenkokke
Copy link
Author

I'd suggest EPOCH as a pattern, so BumpVer is aware of it being a version component, but no corresponding --epoch flag, because bumping the epoch only makes sense if you change your versioning scheme.

Unless --epoch takes a new versioning scheme as an argument, e.g., with version_pattern = "YYYY.BUILD", running --epoch='MAJOR.MINOR.PATCH would bump the epoch and replace the versioning schema. But I suppose that's a lot of work for something that'll be rarely used and difficult to design well.

@mbarkhau
Copy link
Owner

As I said, regardless of adding it, the characters 1! should be captured as literals and work fine as is. I'm still a bit confused about how the behaviour you're describing, as I cannot replicate it with bumpver test.

@wenkokke
Copy link
Author

wenkokke commented May 17, 2023

Try bumpver update --patch with the following:

[project]
version = "1!2.1.5"

[tool.bumpver]
current_version = "v1!2.1.5"
version_pattern = "v1!MAJOR.MINOR.PATCH"

[tool.bumpver.file_patterns]
"pyproject.toml" = [
  'version = "{pep440_version}"',
  'current_version = "{version}"'
]

Which changes version to 12.1.5.

@mbarkhau
Copy link
Owner

Ok, perfect. Thank's for the repro.

@mbarkhau
Copy link
Owner

Try 2023.1124, I think this issue should be fixed.

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

No branches or pull requests

2 participants