`SimpleSpec` with Caret and Prerelease Wrong Behavior
See original GitHub issueHi, I found two issues when using SimpleSpec
with caret and prerelease.
here’s the example
from semantic_version import Version, SimpleSpec
spec = SimpleSpec('^0.0.2-alpha')
print(spec.clause)
# 1st issue
# got AllOf(Range('<', Version('0.0.2')), Range('>=', Version('0.0.2-alpha')))
# which should be >=0.0.2-alpha, <0.0.3 according to https://docs.npmjs.com/cli/v6/using-npm/semver#caret-ranges-123-025-004
print(spec.match(Version('0.0.2-beta')))
# 2nd issue
# got False
# should be True
print(Version('0.0.2-beta') > Version('0.0.2-alpha'))
# got True
# this is correct
Please take a look. Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
python-semanticversion Documentation
Bugfix : • Fix inconsistent behaviour regarding versions with a prerelease specification. Deprecated: • Deprecate the Spec class (Removed in 3.1); ...
Read more >npm - Does caret (^) in semver matches pre-release when pre ...
Typically a range with a caret ( ^ ) prefix such as ^1.0.0 does not result in the prerelease version 1.1.0-prerelease being installed....
Read more >ChangeLog - rbarrois/python-semanticversion - GitHub
Fix inconsistent behaviour regarding versions with a prerelease specification. Deprecated: Deprecate the Spec class (Removed in 3.1); use the SimpleSpec ...
Read more >semantic-version Changelog - PyUp.io
Fix bugs and unexpected behaviours in the ``SimpleSpec`` implementation. ... Fix inconsistent behaviour regarding versions with a prerelease specification.
Read more >Make email display name configurable (!80) · Merge requests - GitLab
An error occurred while fetching the assigned milestone of the selected merge_request. Make email display name configurable.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@hfudev SimpleSpec is not for Python IMHO.
FWIW, I have seen tilde and caret version ranges syntax in node-semver, rubygems-semver, Python pep440 (no caret) and composer-semver and all of the them are different even if if in a subtle way. And Python versions are not semver and the Python version ranges are not the same node-semver at all (even though it may look a bit like node-semver ranges).
In univers (a library that reuses this library) you can see how we implement support
One a side note I would strongly discourage using tilde in Python ranges (and tilde and carets elsewhere) and in general upper bounds on version ranges anywhere because of https://iscinumpy.dev/post/bound-version-constraints/
Thanks for your patience and the blog you shared. Somehow changed my mind after reading this.