Skip to content

Support pip freeze URL format #9280

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

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

smokris
Copy link
Contributor

@smokris smokris commented Mar 3, 2024

pip freeze (https://pip.pypa.io/en/stable/cli/pip_freeze/) "outputs installed packages in requirements format"
(https://pip.pypa.io/en/stable/reference/requirement-specifiers/). As of pip 19.1, pip also supports specifying a requirement as a URL, and, for packages that were installed using URL format, pip freeze will output package requirements in URL format.

However, Puppet's pip freeze parser doesn't support URL format, so it doesn't realize that a package is installed if it uses URL format, causing every puppet agent run to attempt to reinstall the package.

This PR adds support for parsing pip freeze URL format.

Steps to reproduce

$ pip3 install git+https://github.com/bootlin/pdf-link-checker.git
$ pip3 freeze --all | grep pdf
pdf-link-checker @ git+https://github.com/bootlin/pdf-link-checker.git@6b4e203b66c1de7345984882e2b13bf87c700095

`pip freeze` (https://pip.pypa.io/en/stable/cli/pip_freeze/) "outputs
installed packages in requirements format"
(https://pip.pypa.io/en/stable/reference/requirement-specifiers/).
As of pip 19.1, pip also supports specifying a requirement as a URL,
and, for packages that were installed using URL format, `pip freeze`
will output package requirements in URL format.

However, Puppet's `pip freeze` parser doesn't support URL format, so
it doesn't realize that a package is installed if it uses URL format,
causing every `puppet agent` run to attempt to reinstall the package.

This PR adds support for parsing `pip freeze` URL format.
@smokris smokris requested a review from a team as a code owner March 3, 2024 00:08
@puppetlabs-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@joshcooper joshcooper added triaged Jira issue has been created for this bug Something isn't working and removed triaged Jira issue has been created for this labels Mar 12, 2024
@cthorn42 cthorn42 merged commit 9a03c3e into puppetlabs:main Mar 18, 2024
@smokris smokris deleted the pip-freeze-url-format branch March 18, 2024 20:51
@cthorn42 cthorn42 added the backport 7.x Generate a backport PR to 7.x label Mar 20, 2024
Copy link

Backport failed for 7.x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin 7.x
git worktree add -d .worktree/backport-9280-to-7.x origin/7.x
cd .worktree/backport-9280-to-7.x
git checkout -b backport-9280-to-7.x
ancref=$(git merge-base d068941191ba289825b44343fec1a3d3f1173022 207a7dc7f271c9d97be400d0d2ebb80a5cda6cd2)
git cherry-pick -x $ancref..207a7dc7f271c9d97be400d0d2ebb80a5cda6cd2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 7.x Generate a backport PR to 7.x bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants