python-venv-management
Skill0 starsChanged 23 days agoApache-2.0View on GitHub
Creating, managing, and troubleshooting Python virtual environments with uv. Use when setting up isolated Python environments, resolving dependency conflicts, managing multiple project environments, automating setup with scripts or Makefiles, or migrating off system Python, pyenv, or conda.
- Pipes a download into a shell
- Reads credentials
- Installs packages
In this repository13 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- configuration-managementSkill
- designing-clear-data-displaysSkill
- lake-conventionsSkill
- maintaining-project-contextSkill
- maintaining-the-common-operating-pictureSkill
- maintaining-ubiquitous-languageSkill
- recording-architecture-decisionsSkill
- shift-left-testingSkill
- traversing-the-knowledge-baseSkill
- using-topic-branchesSkill
- verifying-claimsSkill
- writing-simple-and-directSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
One venv per project: Default; deviate only with a documented reason.
- Very specific: line 25
uv is the engine: All environment and package operations go through uv venv and uv pip.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Virtual Environment Management (uv)
Isolate Python dependencies per project, prevent conflicts between projects requiring different package versions. uv (Astral) is the engine for all of it: interpreters, environments, and packages. This SKILL.md is the entry point; deep procedural content lives in two sidecar files loaded on demand.
Philosophy: "One project, one environment. Isolate dependencies, document requirements, automate setup."
When to Use
- Setting up a new Python project (always)
- Resolving a dependency conflict between two packages
- Managing multiple environments for the same project (Python version matrix, optional heavy deps)
- Writing or auditing a project's setup script / Makefile
- Migrating an existing codebase off system Python, pyenv, or conda/miniforge
- Diagnosing "module not found" or "wrong Python version" errors
Core Principles
- One venv per project. Default; deviate only with a documented reason.
- uv is the engine. All environment and package operations go through
uv venvanduv pip. Neversudo pip; never system pip. - Managed interpreters.
uv venv --managed-pythonbuilds the venv on a uv-downloaded CPython. The venv then survives removal of pyenv, conda, or a system Python upgrade. - Pin production dependencies. Reproducible builds beat flexibility-at-deploy-time.
- Never commit secrets or the venv directory.
.venv/and.envboth belong in.gitignore.
Quick Reference
Essential Commands
| Task | Command |
| Install uv | curl -LsSf https://astral.sh/uv/install.sh | sh |
| Install an interpreter | uv python install 3.12 |
| Create venv | uv venv --managed-python |
| Activate (Linux/Mac) | source .venv/bin/activate |
| Activate (Windows) | .venv\Scripts\activate |
| Deactivate | deactivate |
| Install deps | uv pip install --python .venv -r requirements.txt |
| Install project (editable) | uv pip install --python .venv -e . |
| Install with dev deps | uv pip install --python .venv -e ".[dev]" |
| Freeze deps to file | uv pip freeze --python .venv > requirements.txt |
| List packages | uv pip list --python .venv |
| Show package info | uv pip show --python .venv <package> |
| Check what's active | which python (should show .venv/bin/python) |
Every uv pip command names its target with --python .venv. A bare uv pip targets an active or inherited VIRTUAL_ENV before the project's .venv, so a variable left over from another repo's shell sends the install there. When the target is not the .venv in the current directory, uv prints Using Python <version> environment at: <path> before it acts; that path is where the packages go. A uv venv does not bundle pip; .venv/bin/pip does not exist, and that is by design.
Directory Conventions
project/
├── .venv/ # Virtual environment (gitignored)
├── requirements.txt # Production dependencies
├── requirements-dev.txt # Development dependencies
├── requirements-test.txt # Test dependencies (optional)
└── pyproject.toml # Modern Python project config (preferred).gitignore Essentials
# Virtual environments
.venv/
venv/
ENV/
.venv-*/
# Environment files (secrets)
.env
.env.local
.env.*.local
# Keep templates
!.env.exampleSidecar Files
Loaded on demand when this SKILL.md cites them.
- SETUP.md — single-vs-multiple environments, setup patterns (bash script, Makefile, pyproject.toml), requirements file organization, pinning strategy, Python version management with
uv python, migrating off pyenv/conda. - TROUBLESHOOTING.md — dependency conflict resolution, environment variables and secrets, the most common venv failure modes with diagnoses and fixes, do/don't checklist.
Quick Anti-Pattern Reference
sudo pip install— never. Indicates you're installing to system Python, not your venv.- Calling
.venv/bin/pip— it does not exist in a uv venv. Useuv pip .... Seed pip only if a tool genuinely requires it (uv venv --seed). - Building the venv on an incumbent's interpreter — a venv symlinked into
~/.pyenv/versions/or a conda install breaks the day that incumbent is removed. Use--managed-python. - Committing
.venv/— adds gigabytes of OS-specific binaries to git. uv pip freeze --python .venv > requirements.txtas your only spec — captures transitive deps and platform quirks; combine with hand-curated direct deps inpyproject.toml.- Sharing a venv across projects — defeats the isolation that's the entire point.
- Mixing system Python and venv —
which pythonshould always point at your.venv/bin/pythonwhen activated.
References
- uv documentation — environments,
uv pip,uv python, caching - Python venv documentation
- pyproject.toml specification
- Replaced by uv: pyenv (
uv python), pipx (uvx), pip-tools (uv pip compile,uv pip sync --python .venv)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

