python-guide
Installation
SKILL.md
Python Guide
Applies to: Python 3.11+, APIs, CLIs, Data Pipelines, Automation
Core Principles
- Type Hints Everywhere: All function signatures, class attributes, and module-level variables must have type annotations
- Explicit Over Implicit: No
*imports, no mutable default arguments, no implicit type coercions - Virtual Environments Always: Never install into system Python; use
venv,uv, orpoetry - Pytest Over unittest: Use pytest for all testing; fixtures and parametrize over setUp/tearDown
- PEP 8 + Ruff: Enforce style mechanically; never rely on manual formatting
Guardrails
Python Version
- Target Python 3.11+ (use
matchstatements,ExceptionGroup,tomllib) - Set
requires-python = ">=3.11"inpyproject.toml - Use
from __future__ import annotationsfor forward references in 3.11
Related skills