Python Environment Tooling#
Runtime Isolation Tooling
System-wide installations result in dependency conflicts.
Approach: Project-specific, isolated virtual environments.
Standard Tooling
venv & pip & dotenv
venv: Generates the isolated.venvdirectory.pip: Installs packages into the localized directory.Requires manual environment activation.
dotenv: CLI tool to inject.envvariables into the runtime (dotenv run -- python ...).
Modern Tooling
uv
Consolidates environment creation, package installation, and execution.
uv sync: Synchronizes dependencies (Relies on native shell variables; does NOT support.envfiles).uv run: Executes scripts within the isolated context.Strict Isolation:
uv runignores.envfiles by default, but can be included (UV_ENV_FILE=.envoruv run --env-file .env ...).