Skip to content

Simplfy the rules for > and <#25

Merged
dstufft merged 3 commits into
pypa:masterfrom
dstufft:simple-comparison-lt-gt
Jan 3, 2015
Merged

Simplfy the rules for > and <#25
dstufft merged 3 commits into
pypa:masterfrom
dstufft:simple-comparison-lt-gt

Conversation

@dstufft

@dstufft dstufft commented Dec 28, 2014

Copy link
Copy Markdown
Member

Instead of having these operators imply a !=V.* this will instead have them more-or-less simply check if the prospective version is greater than or less than the specifier version. They will not however match a post or pre-release of the version mentioned in the specifier unless the specifier itself contains a post or a pre-release. In addition, we will ensure that >V does not match V+local.version even though it is technically greater than V.

In particular that means that something like >1.7 will match 1.7.1 but will not match 1.7.post1 while >1.7.post0 would. Likewise <3.0 would not match 3.0.dev0 while <3.0rc1 would.

This PR also includes two new attributes on Version instances: is_postrelease to determine is a particular release is a post release and base_version which will return just the part of the version which shows the "base" version (e.g. 1.0 is the base version of 1.0.dev0 and 1.0.post0 and 2!1.0 is the base version of 2!1.0.dev0 and 2!1.0.post0).

This requires pypa/interoperability-peps#3 to land before this can be merged.

@qwcode

qwcode commented Dec 29, 2014

Copy link
Copy Markdown

lgtm

@dstufft dstufft changed the title [Proof of Concept] Simplfy the rules for > and < Simplfy the rules for > and < Dec 29, 2014
@dstufft dstufft force-pushed the simple-comparison-lt-gt branch from b2b7e9b to c821038 Compare December 29, 2014 15:12
Instead of having these operators imply a !=.* this will instead
have them more-or-less simply check if the prospective version
is greater than or less than the specifier version. They will not
however match a post or pre-release of the version mentioned in
the specifier unless the specifier itself contains a post or
a pre-release.

In addition, we will ensure that >V does not match V+local.version
even though it is techincally greater than V.
@dstufft dstufft force-pushed the simple-comparison-lt-gt branch from c821038 to e61d0a3 Compare December 29, 2014 17:07
dstufft added a commit that referenced this pull request Jan 3, 2015
@dstufft dstufft merged commit 9da608a into pypa:master Jan 3, 2015
@dstufft dstufft deleted the simple-comparison-lt-gt branch January 3, 2015 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants