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

Handle locked pip version on Windows #6430

Merged

Conversation

radoering
Copy link
Member

Resolves: #6138

Use poetry -m pip ... instead of calling pip directly so that pip can update itself on Windows.

Just to be sure that this has no influence on performance, a little test:

setup = "import subprocess"

variants = {
    'embedded': [PYTHON_PATH, EMBEDDED_PIP_PATH, "-V"],  # fallback + prior #6062
    'bin': [PYTHON_PATH, PIP_PATH, "-V"],  # current
    'module': [PYTHON_PATH, "-m", "pip", "-V"],  # new
}

for name, cmd in variants.items():
    stmt = f"subprocess.check_output({cmd})"
    print(f"{name}: {timeit(stmt, setup, number=5)}")

Sample output:

embedded: 5.4903443
bin: 1.8143028999999995
module: 1.7508081999999998

As expected it makes no difference whether pip is called directly or as module.

Copy link
Member

@neersighted neersighted left a comment

Choose a reason for hiding this comment

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

LGTM -- glad this was as simple as I asserted it was 😆

@radoering radoering merged commit b9ed1f0 into python-poetry:master Sep 6, 2022
@neersighted neersighted added impact/backport Requires backport to stable branch impact/changelog Requires a changelog entry labels Sep 6, 2022
@poetry-bot
Copy link

poetry-bot bot commented Sep 6, 2022

The backport to 1.2 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.2 1.2
# Navigate to the new working tree
cd .worktrees/backport-1.2
# Create a new branch
git switch --create backport-6430-to-1.2
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b9ed1f052fec72ec5dc83c3923d56159ac7fb325
# Push it to GitHub
git push --set-upstream origin backport-6430-to-1.2
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.2

Then, create a pull request where the base branch is 1.2 and the compare/head branch is backport-6430-to-1.2.

@neersighted neersighted added the area/installer Related to the dependency installer label Sep 6, 2022
@neersighted neersighted added this to the 1.3 milestone Sep 17, 2022
Copy link

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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/installer Related to the dependency installer impact/backport Requires backport to stable branch impact/changelog Requires a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot have pip as a requirement on windows
2 participants