Project environments and packages
The single most important habit: one isolated environment per project.
Python Versions
uvpyenv
Python Virtual Environments
venv+pip— built-in, simple, universal. The “old” way to manage Python environments, not recommended.uv— fast, modern, recommended default. Watch an overviewpipenv— modern, handles both env and packages. Watch an overviewconda/mamba— best when you need non-Python binaries (GDAL, CUDA, etc.)poetry,pdm— alternatives worth knowing
Why not use
venvandpip?Designed to solve the problem of virtual environments and package management, these tools are slow and inconsistent. Some reasons newer tools such as
uvare better:
- Speed:
pip’s dependency resolver is slow and venv creation/installs add up.uv(Rust-based) is 10-100x faster via a global cache and parallel installs.- Reproducibility:
pip freezegives a flat, unpinned list — no lockfile, no hash verification, no distinction between direct vs. transitive deps.uvgenerates a proper cross-platform lockfile (uv.lock), so “works on my machine” becomes rare.- Fewer tools:
uvreplacesvenv+pip+pip-tools(and oftenpyenv) with one binary:uv venv,uv add,uv sync,uv run. Less surface area to teach or debug in a lab setting.- Standard-aligned: it’s built around
pyproject.toml, the modern packaging standard, rather thanrequirements.txt.
R
renvfor project-scoped package libraries- CRAN vs. Posit Package Manager vs. GitHub installs
Reproducibility checklist
- A lockfile is committed (
uv.lock,requirements.txt,Pipfile.lock,renv.lock) - The
READMEstates the language version - A new clone can run one command to get a working environment