question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NpmSpec Comparison Between Prerelease Versions is Wrong

See original GitHub issue

Version is 2.8.5.

>>> from semantic_version import NpmSpec, Version
>>> NpmSpec("<0.1.1-alpha.1").match(Version("0.1.1-beta.1"))
True
>>> NpmSpec("<0.1.1-alpha.1").match(Version("0.1.1-rc.1"))
True
>>> NpmSpec("<0.1.1-beta.7").match(Version("0.1.1-beta.8"))
True

They should be false.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tysonliddellcommented, Dec 15, 2022

Here’s another example that doesn’t seem correct.

>>> from semantic_version import NpmSpec, Version
>>> NpmSpec("5.4.0-alpha.0").match(Version("5.4.0-alpha.0"))
True
>>> NpmSpec("5.4.0-alpha.0").match(Version("5.4.0"))
True  # this should be False

The same examples in semver from npm have the correct logic:

> var semver = require('semver');
> semver.satisfies('2.0.0-next.1', '2.0.0-next.1');
true
> semver.satisfies('2.0.0', '2.0.0-next.1');
false
1reaction
smiller171commented, Sep 16, 2020

oh and the same issue with ~2.0.1- not matching anything

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide — python-semanticversion latest documentation
Comparing version numbers isn't always enough; in many situations, one needs to define a range of acceptable versions. That notion is not defined...
Read more >
vyperlang/community - Gitter
Trying to build an old Vyper contract from over a year ago (required a patched beta version at the time) with a new...
Read more >
semantic-version - PyPI
It follows strictly the 2.0.0 version of the SemVer scheme. ... Obviously, versions can be compared: ... pre-release doesn't satisfy version spec False...
Read more >
Prereleases and Npm - Medium
I recently published the first prereleases of D3 4.0 alpha to npm. ... By default, prerelease versions are not included in a range....
Read more >
Changing Cargo semver compatibility for pre-releases
Now if Cargo were to decide to change its interpretation of pre-release reqs in a future version (via a Cargo RFC), this crate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found