You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a new single number (monotonic) versioning schema.
For example:
v1, v2, v3, ...
Possible Solution
Adding a new schema. It won't affect the rest of the code.
I have already implemented this feature for our own use. Wanted to share if it will be useful for others.
Additional context
Some services are using monotonic versioning (e.g. AWS SageMaker Models) for their artifacts, this will enable the users to keep the code and registry in sync.
I wonder how monotonic versioning works. It would be great if you could provide some references.
The only reference I could find using the keyword "monotonic versioning" is monotonic-versioning-manifesto, but it does not work as you mentioned in the issue description.
I can see the confusion. I picked the name "monotonic" purely based on what it means and honestly didn't really dig into the specifications.
For what I meant this to be, version only has 1 section, a single number that only can increases. In my PR I treated it as the major section of the version to don't change a lot from the code.
I would ask AI to provide naming suggestions. Naming is hard.
"Monotonic" has nothing to do with "single". Probably "Single number version" or "Monic version"? (I haven't checked if the names are already used.)
Despite the naming, making your custom version scheme as a third-party plugin is a preferred way to extend our tool, as we want to keep our core code light. You may refer to our third-party-plugin documentation for more details. If you still have questions, feel free to discuss here!
I took a look at plugins and tried to implement one, however, I will need a small change in the tags.py to get the plugin working. Would it be ok to send that change along with the documentation?
When the version is just a single number, it can't get unpacked to major, minor, patch. The easiest way to handle this, is to consider it as a major version. e.g. v1 -> v1.0.0.
However, since the version of the projects are actually single numbers, they will get ValueError: not enough values to unpack (expected 3, got 1) error on that line. The change I suggest will only consider tham as a major version instead.
To test this out, you can try run any of the commands on an empty project with version 1 on their pyproject.toml file.
If I understand correctly, the basic assumption for commitizen version providers is that the release version number always consists of three numbers. @woile@Lee-W wdyt
Activity
bearomorphism commentedon Dec 10, 2025
Hi @YazdanRa , thanks for your contribution!
I wonder how monotonic versioning works. It would be great if you could provide some references.
The only reference I could find using the keyword "monotonic versioning" is monotonic-versioning-manifesto, but it does not work as you mentioned in the issue description.
YazdanRa commentedon Dec 10, 2025
Hi @bearomorphism, Thanks for prompt response!
I can see the confusion. I picked the name "monotonic" purely based on what it means and honestly didn't really dig into the specifications.
For what I meant this to be, version only has 1 section, a single number that only can increases. In my PR I treated it as the major section of the version to don't change a lot from the code.
I probably should change the naming so it's not confusing. Any suggestions on what it should be called instead?
YazdanRa commentedon Dec 10, 2025
Maybe "Sequential Version", "Integer Version", "Number Version", "Single Number Version".
bearomorphism commentedon Dec 11, 2025
I would ask AI to provide naming suggestions. Naming is hard.
"Monotonic" has nothing to do with "single". Probably "Single number version" or "Monic version"? (I haven't checked if the names are already used.)
Despite the naming, making your custom version scheme as a third-party plugin is a preferred way to extend our tool, as we want to keep our core code light. You may refer to our third-party-plugin documentation for more details. If you still have questions, feel free to discuss here!
YazdanRa commentedon Dec 12, 2025
I took a look at plugins and tried to implement one, however, I will need a small change in the
tags.pyto get the plugin working. Would it be ok to send that change along with the documentation?Currently we have:
commitizen/commitizen/tags.py
Line 231 in 1e5869e
I would like to change it to:
This is the minimum change required to get is work for versions that are less than 3 components.
[-]Monotonic Versioning Schema[/-][+]Mono Versioning Schema[/+]bearomorphism commentedon Dec 12, 2025
I believe the type of
version.releaseshould beTuple[int, int, int], although it'sTuple[int, ...]on master now.Is there any reason you think the change should be at core code?
YazdanRa commentedon Dec 12, 2025
When the version is just a single number, it can't get unpacked to major, minor, patch. The easiest way to handle this, is to consider it as a major version. e.g.
v1->v1.0.0.However, since the version of the projects are actually single numbers, they will get
ValueError: not enough values to unpack (expected 3, got 1)error on that line. The change I suggest will only consider tham as a major version instead.To test this out, you can try run any of the commands on an empty project with version
1on theirpyproject.tomlfile.bearomorphism commentedon Dec 12, 2025
If I understand correctly, the basic assumption for commitizen version providers is that the release version number always consists of three numbers. @woile @Lee-W wdyt
woile commentedon Dec 12, 2025
I think we can allow the change as long as all the tests are passing 👍🏻
We try to give as much flexibility as possible for version providers, as long as the core keeps working
YazdanRa commentedon Dec 12, 2025
I did updated the PR and removed the extra stuff, just kept the version unpacking change and added some specific test for that.
PR is now ready for review ツ
I created the plugin but haven't published nor included in this PR as it will require the new version of commitizen as its dependency.
Will send a separate PR later to add it to the documentation once its published.
Thanks!