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

Fix update for pre-release version #693

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

teluq-pbrideau
Copy link

@teluq-pbrideau teluq-pbrideau commented Jun 17, 2024

Pull Request (PR) description

Fix the resolution of the latest version from the pip repository, by removing the pre-release version from the list of the latest package available. See #690 for details.

I’ve added a boolean parameter pre_release.
It should be used instead of install_args => '--pre' for the ensure => latest to be aware of the version.
I chose to add this parameter instead of trying to parse the install_args parameter.

The new pip version (24.1b2) does not support notreallyaversion as a package version. I used 0.0 as replacement
EDIT: I’ve reused the version that was changed in master.

:~$ pip --version
pip 24.1b2 from /opt/puppetapi/lib64/python3.9/site-packages/pip (python 3.9)
:~$ pip install pip==notreallyaversion
ERROR: Invalid requirement: 'pip==notreallyaversion': Expected end or semicolon (after name and no valid version specifier)
    pip==notreallyaversion
       ^
:~$ pip install pip==0.0
ERROR: Ignored the following yanked versions: 20.0, 20.3.2, 21.2
ERROR: Could not find a version that satisfies the requirement pip==0.0 (from versions: 0.2, 0.2.1, 0.3, 0.3.1, 0.4, 0.5, 0.5.1, 0.6, 0.6.1, 0.6.2, 0.6.3, 0.7, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.8.2, 0.8.3, 1.0, 1.0.1, 1.0.2, 1.1, 1.2, 1.2.1, 1.3, 1.3.1, 1.4, 1.4.1, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 6.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.1.0, 6.1.1, 7.0.0, 7.0.1, 7.0.2, 7.0.3, 7.1.0, 7.1.1, 7.1.2, 8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.1.0, 8.1.1, 8.1.2, 9.0.0, 9.0.1, 9.0.2, 9.0.3, 10.0.0b1, 10.0.0b2, 10.0.0, 10.0.1, 18.0, 18.1, 19.0, 19.0.1, 19.0.2, 19.0.3, 19.1, 19.1.1, 19.2, 19.2.1, 19.2.2, 19.2.3, 19.3, 19.3.1, 20.0.1, 20.0.2, 20.1b1, 20.1, 20.1.1, 20.2b1, 20.2, 20.2.1, 20.2.2, 20.2.3, 20.2.4, 20.3b1, 20.3, 20.3.1, 20.3.3, 20.3.4, 21.0, 21.0.1, 21.1, 21.1.1, 21.1.2, 21.1.3, 21.2.1, 21.2.2, 21.2.3, 21.2.4, 21.3, 21.3.1, 22.0, 22.0.1, 22.0.2, 22.0.3, 22.0.4, 22.1b1, 22.1, 22.1.1, 22.1.2, 22.2, 22.2.1, 22.2.2, 22.3, 22.3.1, 23.0, 23.0.1, 23.1, 23.1.1, 23.1.2, 23.2, 23.2.1, 23.3, 23.3.1, 23.3.2, 24.0, 24.1b1, 24.1b2)
ERROR: No matching distribution found for pip==0.0

This Pull Request (PR) fixes the following issues

Fixes #690

@teluq-pbrideau teluq-pbrideau marked this pull request as draft June 17, 2024 16:09
@teluq-pbrideau
Copy link
Author

Well, thinking more about it, it is probably better for me to parse install_args for the --pre flag, because it does not create a breaking change… I’ll modify the PR.

@teluq-pbrideau teluq-pbrideau force-pushed the fix/latest_prerelease branch from 9d3e063 to 6a42c5c Compare June 17, 2024 16:55
@teluq-pbrideau teluq-pbrideau marked this pull request as ready for review June 27, 2024 13:16
@bastelfreak
Copy link
Member

Hi @teluq-pbrideau , we recently merged #696 . can you please rebase?

manifests/pip.pp Outdated Show resolved Hide resolved
@teluq-pbrideau
Copy link
Author

teluq-pbrideau commented Aug 22, 2024

I’ve discovered a potential difference when a package have only pre-release version. I’ve tried with the first package i’ve found with this criteria: glint4py: https://pypi.org/project/glint4py/#history

When package installed with pip install, the package is installed, but with the python::pip class with my change, it is required to add the install_args => '--pre' parameter. Not sure it is desired…

Also, I cannot find a package with pre-release and a previous stable release to test as I did with pip==24.1.b2

@teluq-pbrideau
Copy link
Author

@kenyon just to make sure you understood my previous comment:
Every current user of this module will have a breaking change and will have to add install_args => '--pre' if there is no stable release on pypi

@kenyon
Copy link
Member

kenyon commented Aug 22, 2024

@teluq-pbrideau thanks for the clarification. I'm not using this functionality of this module, so this doesn't really affect me, but it seems like it's OK if you have to explicitly do something to enable installation of prereleases, even if pip itself doesn't behave this way. But maybe we wait for more input from users to see whether the breaking change is acceptable.

I know some tools like pipenv have extra difficulty dealing with prereleases, so this problem has some precedent in the Python world. The popular formatter black caused a lot of consternation for years because it was only a prerelease: psf/black#517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Puppet python latest version resolving - Prereleases
3 participants