Skip to content

Check pip availability before running ensurepip#392

Open
priyagupta108 wants to merge 1 commit intoactions:mainfrom
priyagupta108:skip-ensurepip
Open

Check pip availability before running ensurepip#392
priyagupta108 wants to merge 1 commit intoactions:mainfrom
priyagupta108:skip-ensurepip

Conversation

@priyagupta108
Copy link
Copy Markdown
Contributor

This pull request improves the robustness of the Python installation scripts across macOS, Linux, and Windows by ensuring that pip is only bootstrapped with ensurepip if it is not already present. This prevents unnecessary reinstallation and potential errors during setup.

Copilot AI review requested due to automatic review settings May 8, 2026 07:59
@priyagupta108 priyagupta108 requested a review from a team as a code owner May 8, 2026 07:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request improves the robustness of the Python toolcache setup templates by only running ensurepip when pip is not already importable for the target interpreter, avoiding redundant bootstrapping steps across Windows, Linux, and macOS.

Changes:

  • Windows: check import pip before invoking python -m ensurepip.
  • Linux/macOS: gate ./python -m ensurepip behind an import pip check (with stderr suppressed).
  • Keep the existing pip install --upgrade --force-reinstall pip ... upgrade flow unchanged.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
installers/win-setup-template.ps1 Adds a pip import check before running ensurepip, then upgrades/reinstalls pip as before.
installers/nix-setup-template.sh Runs ensurepip only when pip isn’t importable, then performs the same pip upgrade/reinstall.
installers/macos-pkg-setup-template.sh Mirrors the nix template change: conditionally run ensurepip based on import pip, then upgrade/reinstall.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@priyagupta108 priyagupta108 self-assigned this May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants