Environments & Package Tooling
Practical reference for deterministic Python environment isolation, dependency managers (pyenv, poetry, pip, conda), and runtime configuration.
Python Version Management (pyenv)
Install and manage multiple isolated CPython versions without polluting system interpreters:
# Install a specific CPython version
pyenv install 3.12.8
# Pin the local project directory to this Python version (.python-version file)
pyenv local 3.12.8
# Verify the active interpreter
pyenv which pythonOnce pinned, bootstrap an isolated virtual environment:
python -m venv .venv
source .venv/bin/activateDependency Management with Poetry
Enforce In-Project Virtual Environments
By default, Poetry creates virtual environments in a global cache directory. Enforce local .venv creation inside the repository root for predictable IDE discovery:
poetry config virtualenvs.in-project trueEnvironment Inspection
Query active environment metadata:
# Print the absolute path to the active virtualenv
poetry env info -p
# Display full environment diagnostic info (Python version, platform, path)
poetry env infoPackage Resolvers (pip & conda)
Pip Configuration Inspection
Inspect the active hierarchical configuration of pip across global, user, and site levels:
pip config -v listWindows Configuration Override
On Windows hosts (PowerShell), point pip to a custom configuration file via environment variable:
$Env:PIP_CONFIG_FILE = "C:\path\to\your\pip.ini"Conda Channel Priorities
Query the exact resolution order of active Conda package channels:
conda config --get channelsReference Guides & Cheat Sheets
Tip
Offline Reference: A comprehensive Python AsyncIO Cheat Sheet (PDF) is available for offline download.