Skip to content

Comments

Fix PEP440 compatible release (~=) handling#1815

Merged
sdispater merged 2 commits intopython-poetry:masterfrom
chongkong:fix-pep440-compatible-release
Jan 6, 2020
Merged

Fix PEP440 compatible release (~=) handling#1815
sdispater merged 2 commits intopython-poetry:masterfrom
chongkong:fix-pep440-compatible-release

Conversation

@chongkong
Copy link
Contributor

@chongkong chongkong commented Jan 2, 2020

PEP440 compatible release version range (~=) should have itself as a minimum value. Examples from official doc (each pair is equivalent):

~=2.2
>=2.2, ==2.*

~=1.4.5
>=1.4.5, ==1.4.*

~=2.2.post3
>=2.2.post3, ==2.*

~=1.4.5a4
>=1.4.5a4, ==1.4.*

In every case, lower bound is exactly same as the input version including rest and pre but current behavior drop other than major, minor and patch. Current incorrect behavior was originally introduced 2 years ago by commit c55d55a, where it tried to reset patch version to 0 for tilde expression, and hasn't been fixed by #1481, which only added up to patch version.

Closes #1150

  • Added tests for changed code.
  • Updated documentation for changed code.

PEP440 compatible release version range (`~=`) should have itself as a minimum
value. Examples from [official
doc](https://python.org/dev/peps/pep-0440/#compatible-release) (each pair is
equivalent):

```
~=2.2
>=2.2, ==2.*

~=1.4.5
>=1.4.5, ==1.4.*

~=2.2.post3
>=2.2.post3, ==2.*

~=1.4.5a4
>=1.4.5a4, ==1.4.*
```

In every case, lower bound is exactly same as the input version. Current
incorrect behavior was originally introduced 2 years ago by commit c55d55a,
where it tried to reset patch version to 0 for tilde expression.

Closes python-poetry#1150.
Copy link
Member

@finswimmer finswimmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍 Thanks a lot!

@sdispater sdispater merged commit 950415c into python-poetry:master Jan 6, 2020
@github-actions
Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pre-release ~= constrains are mis calculated

3 participants