748 B
748 B
Coding Standards for SNS Network Solutions
Python
- Use type hints on all function signatures
- Use dataclasses for data containers (not plain dicts)
- Use pathlib.Path (never os.path)
- Use httpx (not requests) for HTTP calls
- Always include docstrings on public functions
- Error handling: use specific exceptions, never bare except
File Structure
- One module per concern
- Tests in tests/ directory, mirroring src/ structure
- Config in config/ as YAML
Naming
- snake_case for functions and variables
- PascalCase for classes
- UPPER_CASE for constants
- Prefix private functions with underscore
Patterns
- Dependency injection over global state
- Async by default for I/O operations
- Return early on error (guard clauses)