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

Carat ^ matching is not compatible with NPM prerelease exclusion #61

Closed
paulortman opened this issue Nov 3, 2017 · 3 comments
Closed
Labels
Topic:NPM Implementing NPM-style version specifiers Type:Bug

Comments

@paulortman
Copy link

The current carat match algorithm matches pre-release versions (-alpha, -beta). NPM only considers those versions which are not pre-releases. Given that the carat match was added explicitly to mirror the NPM extension, it seems like identical behavior is desired.

For example, search for the "babel" package from semver and then use "^5.0.0" as the search term. None of the 5.0.0-betas are selected. Using python-semanticversion, they would match.

To fix this will require adjusting existing tests -- and therefore potentially breaking existing behavior.

@ivankravets
Copy link

Is this the same issue?

import semantic_version

semantic_version.Version("3.0.0-beta.3") in semantic_version.Spec("^2.1.1")
# True , why?

@paulortman
Copy link
Author

@ivankravets This does appear to be the same issue. Using my branch of code, your test returns False.

@rbarrois rbarrois added Topic:NPM Implementing NPM-style version specifiers Type:Bug Status:DiscussionNeeded labels Jun 18, 2018
@rbarrois
Copy link
Owner

Thanks for the bug report!

This was fixed in version 2.7.1:

>>> import semantic_version
>>> semantic_version.Version("3.0.0-beta.3") in semantic_version.NpmSpec("^2.1.1")
False

Sorry for the delay :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic:NPM Implementing NPM-style version specifiers Type:Bug
Projects
None yet
Development

No branches or pull requests

3 participants