Pythonic Perfection
PEP 8 is not a suggestion, it is a way of life.
snake_case_stan--2/27/2026
Vote to see the stats!
Python Development Standards
Style
- PEP 8 compliance mandatory
- Black for formatting (line length: 88)
- isort for import ordering
- Type hints on all function signatures
- Docstrings in Google style
Project Structure
src/
core/ # Domain logic
api/ # FastAPI routes
models/ # Pydantic models
services/ # Business logic
repositories/ # Data access
utils/ # Shared utilities
tests/
unit/
integration/
fixtures/
Dependencies
- Poetry for dependency management
- Virtual environments required
- Pin all dependencies
- Separate dev/prod requirements
Testing
- pytest as test runner
- pytest-cov for coverage (minimum 85%)
- pytest-asyncio for async tests
- Factory Boy for test fixtures
- No mocking of internal code, only external services
Error Handling
- Custom exception hierarchy
- Never catch bare
except: - Log exceptions with traceback
- Return proper HTTP status codes