Skip to content

Python

🏠 Home

Reproducible environments for scripts, notebooks, and small projects.

Modern Python development is about creating consistent, reproducible environments that work the same way across different machines and team members. This section covers the essential tools and patterns for clean Python development.

🎯 Goals

  • Reproducible environments with pyenv and uv
  • Clean project structure that scales from scripts to packages
  • Effective workflows for notebooks, testing, and CLI tools
  • Modern tooling that actually makes development faster

🔍 Quick Verification

Test your Python environment:

# Check Python version management
pyenv --version
pyenv versions

# Check fast package manager
uv --version

# Check current Python and pip
python --version
python -m pip --version

# Test virtual environment creation
uv venv test-env --python 3.12
source test-env/bin/activate  # Linux/macOS
deactivate && rm -rf test-env

📚 Essential Guides

Environment & Setup

Development Workflows

  • Notebooks - Jupyter and VS Code notebook best practices
  • Data Workflow - Pandas quickstart for data projects
  • CLI Basics - python -m usage and argparse patterns
  • Testing - pytest fundamentals and test organization

Advanced (Optional)

  • Lint & Format - ruff and black setup (coming soon)
  • Packaging - Building and distributing Python packages (coming soon)

🚀 Common Workflows

New Project Setup

  1. Create directorymkdir my-project && cd my-project
  2. Initialize environmentInstall & Setup
  3. Set up structureProject Structure
  4. Install dependenciesEnvironments & Dependencies
  5. Start coding → Choose notebooks, scripts, or packages

Typical Project Structure

my-project/
├── .gitignore           # Python-specific ignores
├── .python-version      # pyenv version pinning  
├── README.md           # Project documentation
├── pyproject.toml      # Modern Python configuration
├── requirements.txt    # or uv.lock for dependencies
├── src/               # Source code directory
│   └── my_project/    # Main package
├── tests/             # Test files
├── notebooks/         # Jupyter notebooks (optional)
└── scripts/           # Utility scripts (optional)
  • Data Analysis - Using Python for data exploration and analysis
  • Git - Version control workflow for Python projects
  • AI Tools - Using Claude Code and other AI tools with Python
  • Toolkit - VS Code and development environment setup

⚡ Quick References

Environment Management:

# Create and activate virtual environment
uv venv .venv --python 3.12
source .venv/bin/activate  # Linux/macOS
# .venv\Scripts\activate   # Windows

# Install dependencies
uv pip install pandas matplotlib jupyter
uv pip install -r requirements.txt

# Generate requirements
uv pip freeze > requirements.txt

Project Initialization:

# Quick project setup
mkdir my-project && cd my-project
echo "3.12" > .python-version
uv venv .venv --python 3.12
source .venv/bin/activate
mkdir src tests
touch README.md .gitignore pyproject.toml

Common Commands:

# Run Python module
python -m my_package

# Run tests
python -m pytest

# Install in development mode
pip install -e .

# Start Jupyter
jupyter lab

Basic Script Template:

#!/usr/bin/env python3
"""
Brief description of what this script does.
"""

def main():
    """Main function."""
    print("Hello, World!")

if __name__ == "__main__":
    main()


Start here: If you're new to modern Python development, begin with Install & Setup to get pyenv and uv working, then follow Project Structure for organizing your code.