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

Pre-release versions not included when specifying version interval #8425

Closed
andy-maier opened this issue Jun 11, 2020 · 3 comments
Closed

Pre-release versions not included when specifying version interval #8425

andy-maier opened this issue Jun 11, 2020 · 3 comments

Comments

@andy-maier
Copy link

andy-maier commented Jun 11, 2020

Environment

  • pip version: 20.1.1
  • Python version: 3.8.2
  • OS: macOS 10.15.5

Description

Since we are about to release our first pre-release version of a package, I did some experiments using pip in that area, and I found that pip does not properly consider the versioning order for pre-releases in some cases. I did read some of the issues in that area (specifically #4969, #7579, https://discuss.python.org/t/version-specifier-sets-and-prereleases/3000) but I think this issue reported here is not covered in those).

I used the "apispec" package for these experiments, which has some pre-release versions before its 1.0.0 version:
..., 0.39.0, 1.0.0b1, 1.0.0b2, 1.0.0b3, 1.0.0b4, 1.0.0b5, 1.0.0b6, 1.0.0rc1, 1.0.0, 1.1.0, ...

Here are the experiments, and my judgement of the result (I uninstalled the package in between the experiments)::

  • pip install 'apispec>0.39.0,<1.0.0' - does not find a version - OK
  • pip install 'apispec>0.39.0,<1.0.0' --pre - does not find a version - STRANGE
  • pip install 'apispec>0.39.0,<1.0.0rc1' - does not find a version - STRANGE
  • pip install 'apispec>0.39.0,<=1.0.0rc1' - installs apispec-1.0.0rc1 - OK
  • pip install 'apispec>=1.0.0b1,<1.0.0' - does not find a version - STRANGE
  • pip install 'apispec>=1.0.0b1,<1.0.0' --pre - does not find a version - STRANGE
  • pip install 'apispec==1.0.0b1' - installs apispec-1.0.0b1 - OK

In all cases marked as STRANGE, there is a trigger to include pre-release versions, either by means of specifying a pre-release version in the version specification, or by means of specifying the --pre option, or both, and there are one or more pre-release versions that match the version specification. Nevertheless, no pre-release version is found to be installed. According to the version sequence shown further up, each of these cases should have found one or more pre-release versions that satisfy the version specification.

Expected behavior

  1. If the inclusion of pre-releases is enabled by any trigger, the order of versions according to PEP 440 including any pre-release versions should be used to evaluate the version constraints.

  2. I wish there would be a more detailed description of the behavior for pre-releases in the pip documentation.

How to Reproduce

See the experiments listed above. Make sure that the package gets uninstalled before each experiment.

@uranusjr
Copy link
Member

uranusjr commented Jun 11, 2020

Without looking into the actual implementation, this should likely be reported to pypa/packaging, which implements the actual version comparison logic.

@andy-maier
Copy link
Author

I have opened pypa/packaging#315, pointing back to here for details.

@pradyunsg
Copy link
Member

As noted in the packaging issue, this is expected behavior. Thanks for filing this @andy-maier, I'm going to go ahead and eagerly close this.

If we decide over on packaging that this behavior should be changed, we can reopen/revisit this issue. :)

@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Feb 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants