actions / actions/setup-python

Add "Externally Managed Environments" support to block global package installations via pip

Open
#1,115 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
TypeScript
Stars
2.2k
Forks
739
Avg merge
6d 18h
Merged PRs (30d)
1

Description

Description:
To prevent system package breakage, many Linux distributions are now restricting pip install to virtual environments or uv environments (something private either way). In self-hosted environments, especially when using ephemeral runners, the hosted tools cache functionality is critical for scaling.

The current methodology allows a pip install to install directly to the cached directory for a given Python after installation, which leads to potentially broken dependency trees and all other kinds of errors if developers are not careful with their package installs. It can also lead to weird race conditions in the same way.

I propose a new input for actions/setup-python that creates the EXTERNALLY-MANAGED file right before a version of Python is marked as available (e.g. creation of the x64.complete file) that would block global pip installs.

https://packaging.python.org/en/latest/specifications/externally-managed-environments/#externally-managed-environments

Justification:
Did all of this in the above. Didn't read the template first.

Are you willing to submit a PR?
Absolutely. This is more of a RFC to gauge the level of interest here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the setup-python tool-cache path that marks an installed Python version available, then review the linked externally managed environments specification. Determine how the marker should be created before availability is recorded and what existing tests cover cached Python installations. Done means global pip installs are blocked for the cached interpreter without disrupting supported virtual-environment or uv workflows.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
ci-cd, devops, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.