Python Environment Tooling

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 .venv directory.

  • pip: Installs packages into the localized directory.

  • Requires manual environment activation.

  • dotenv: CLI tool to inject .env variables 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 .env files).

  • uv run: Executes scripts within the isolated context.

  • Strict Isolation: uv run ignores .env files by default, but can be included (UV_ENV_FILE=.env or uv run --env-file .env ...).