fix: use Python venv for pip installs in shared Python workflows#24053
fix: use Python venv for pip installs in shared Python workflows#24053
Conversation
…n shared workflows Agent-Logs-Url: https://github.com/github/gh-aw/sessions/5fb6f23a-cf0a-41dd-ad53-e7b90ff6422d Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot do a security review of this change |
…packages Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d9f121ed-8b03-4036-a6b7-f8973e7a2c04 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Security review findings (commit
Fix applied: Replaced
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Updates shared GitHub Actions Python setup to avoid pip install --user failures on newer Debian/Ubuntu runners (PEP 668) by installing dependencies into a dedicated virtual environment and ensuring workflows have a known Python runtime.
Changes:
- Switched shared Python install steps from
pip install --userto a reusable venv at/tmp/gh-aw/venvand added the venvbindirectory to$GITHUB_PATH. - Regenerated workflow lock files to use the venv-based installs and added
actions/setup-python(Python 3.12) where needed. - Updated all affected scientific/NLP install and verification commands to run from the venv interpreter.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/shared/python-dataviz.md | Install scientific libs into /tmp/gh-aw/venv and verify using venv Python. |
| .github/workflows/shared/python-nlp.md | Install NLP libs into /tmp/gh-aw/venv, download NLTK corpora using venv Python. |
| .github/workflows/shared/trending-charts-simple.md | Use /tmp/gh-aw/venv for trending chart dependencies and expose venv on PATH. |
| .github/workflows/weekly-issue-summary.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/stale-repo-identifier.lock.yml | Add setup-python and switch scientific installs (including trending section) to venv. |
| .github/workflows/python-data-charts.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/prompt-clustering-analysis.lock.yml | Add setup-python and switch NLP/scientific installs to venv. |
| .github/workflows/portfolio-analyst.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/org-health-report.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/github-mcp-structural-analysis.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/daily-repo-chronicle.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/daily-performance-summary.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/daily-news.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/daily-issues-report.lock.yml | Add setup-python and switch scientific + NLP installs to venv. |
| .github/workflows/daily-integrity-analysis.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/daily-firewall-report.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/daily-copilot-token-report.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/daily-code-metrics.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/copilot-session-insights.lock.yml | Add setup-python and switch scientific installs to venv. |
| .github/workflows/copilot-pr-nlp-analysis.lock.yml | Add setup-python and switch scientific + NLP installs to venv. |
| .github/workflows/audit-workflows.lock.yml | Add setup-python and switch scientific installs to venv. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pip install --userfails on newer Debian/Ubuntu runners with PEP 668'sexternally-managed-environmenterror, breaking any workflow that imports the shared Python setup files.Changes
shared/python-dataviz.md,shared/python-nlp.md,shared/trending-charts-simple.md: replacepip install --userwith a proper Python virtual environment (python3 -m venv /tmp/gh-aw/venv) for package isolationmake recompileUsing a virtual environment avoids bypassing the PEP 668 OS-level protection (
--break-system-packages) and provides proper package isolation without system-level side effects. The venv is created idempotently so workflows importing bothpython-dataviz.mdandpython-nlp.mdsafely share the same venv. The venv bin directory is added to$GITHUB_PATHso subsequent steps and the AI agent can usepython3/piptransparently.Fixes
daily-issues-reportand all other workflows importing these shared files.