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

Can Version.coerce() accept leading zeroes? #89

Closed
andrew-ni opened this issue Dec 19, 2019 · 2 comments
Closed

Can Version.coerce() accept leading zeroes? #89

andrew-ni opened this issue Dec 19, 2019 · 2 comments
Labels
Topic:API Improvements to the library API Type:Enhancement

Comments

@andrew-ni
Copy link

Is it possible to allow something like this? Version.coerce('1.01.1')

This raises a ValueError: Invalid leading zero in minor: '1.01.1'

but is there a specific reason why the coerce function shouldn't be able to handle this? This would be very useful as a lot of programs (docker, ubuntu) use the format: YY.MM.patch

@rbarrois rbarrois added Status:CodeWelcome This feature design has been approved; next step: write the code! Topic:API Improvements to the library API Type:Enhancement labels Dec 21, 2019
@rbarrois
Copy link
Owner

Hey, thanks for the report; this does look like a neat enhancement indeed :)

rbarrois added a commit that referenced this issue Dec 21, 2019
A leading zero is forbidden in the SemVer spec, but could be valid under
other schemes; when coercing, it can easily be removed.

Closes #89, thanks to Andrew Ni for the report.
@rbarrois
Copy link
Owner

And that's fixed, released in 2.8.4 :)

@rbarrois rbarrois removed the Status:CodeWelcome This feature design has been approved; next step: write the code! label Dec 21, 2019
bmwiedemann referenced this issue in bmwiedemann/openSUSE Mar 26, 2020
https://build.opensuse.org/request/show/787484
by user scarabeus_iv + dimstar_suse
- version update to 2.8.4
  * `#89 <https://github.com/rbarrois/python-semanticversion/issues/89>`_:
    Properly coerce versions with leading zeroes in components (e.g.
    ``1.01.007``)
  - Add `Clause.prettyprint()` for debugging
  * `#86 <https://github.com/rbarrois/python-semanticversion/issues/86>`_:
    Fix handling of prerelease ranges within `NpmSpec`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic:API Improvements to the library API Type:Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants