Article 2: Development Environment Setup
Introduction
Development Environment Overview
Python Installation
Using pyenv for Version Management
# Install pyenv (macOS)
brew install pyenv
# Install pyenv (Linux)
curl https://pyenv.run | bash
# Add to shell configuration (~/.zshrc or ~/.bashrc)
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# Restart shell
exec "$SHELL"Installing Python Versions
Python Version Selection
Version
Status
Recommendation
Virtual Environments
Why Virtual Environments?
Creating Virtual Environments
Using venv (Built-in)
Using uv (Modern, Fast)
Virtual Environment Best Practices
Dependency Management
requirements.txt (Traditional)
pyproject.toml (Modern)
Dependency Version Pinning
Specifier
Meaning
Use Case
Project Structure
Standard Python Project Layout
The src Layout
Package Initialization
IDE Configuration (VS Code)
Essential Extensions
Workspace Settings
Launch Configuration
Environment Variables
Using .env Files
Loading Environment Variables
Environment Template
Pre-commit Hooks
Setting Up Pre-commit
Configuration
Pre-commit Workflow
Development Workflow
Complete Setup Script
Makefile for Common Tasks
Practical Exercise
Exercise 1: Complete Project Setup
Exercise 2: Configure Development Tools
Exercise 3: First Test
Environment Checklist
Key Takeaways
What's Next?
Last updated