Part 2: Python Tooling for AI Engineers
Why Python Won
Project Structure
ai-engineer-project/
βββ pyproject.toml # Dependencies, metadata, tool config
βββ README.md
βββ .env.example # Template for required environment variables
βββ .gitignore
βββ docker-compose.yml # PostgreSQL + pgvector for local dev
βββ src/
β βββ ai_engineer/
β βββ __init__.py
β βββ main.py # FastAPI app entry point
β βββ config.py # Settings from environment variables
β βββ models.py # Pydantic request/response models
β βββ llm/
β β βββ __init__.py
β β βββ base.py # LLMProvider protocol
β β βββ openai.py # OpenAI implementation
β β βββ github.py # GitHub Models implementation
β βββ embeddings/
β β βββ __init__.py
β β βββ base.py # EmbeddingProvider protocol
β β βββ local.py # sentence-transformers
β βββ db/
β βββ __init__.py
β βββ engine.py # SQLAlchemy async engine
β βββ models.py # Database table models
βββ tests/
β βββ conftest.py
β βββ test_config.py
β βββ test_llm.py
β βββ test_embeddings.py
βββ scripts/
βββ seed.py # Data loading / one-off scriptsPackage Management with uv
pyproject.toml β The Single Source of Truth
Configuration with Pydantic Settings
The Essential Library Stack
FastAPI β Async API Framework
Pydantic β Data Validation
httpx β Async HTTP Client
sentence-transformers β Local Embeddings
Development Environment Setup
Type Safety Strategy
Use Protocols Instead of Abstract Base Classes
Run mypy in CI
Linting and Formatting with Ruff
Testing Setup
VS Code Configuration
What's Next
Last updated