Python Code Quality
Quick Commands
All commands run from the python/ directory:
# Syntax formatting + checks (parallel across packages by default)
uv run poe syntax
uv run poe syntax -P core
uv run poe syntax -F # Format only
uv run poe syntax -C # Check only
uv run poe syntax -S # Samples only
# Type checking
uv run poe pyright # Pyright fan-out across packages
uv run poe pyright -P core
uv run poe pyright -A
uv run poe mypy # MyPy fan-out across packages
uv run poe mypy -P core
uv run poe mypy -A
uv run poe typing # Both pyright and mypy
uv run poe typing -P core
uv run poe typing -A
# All package-level checks in parallel (syntax + pyright)
uv run poe check-packages
# Full check (packages + samples + tests + markdown)
uv run poe check
uv run poe check -P core
# Samples only
uv run poe check -S
uv run poe pyright -S
# Markdown code blocks
uv run poe markdown-code-lint
Pre-commit Hooks (prek)
Prek hooks run automatically on commit. They stay lightweight and only check
changed files.
# Install hooks
uv run poe prek-install
# Run all hooks manually
uv run prek run -a
# Run on last commit
uv run prek run --last-commit
They run changed-package syntax formatting/checking, markdown code lint only
when markdown files change, and sample syntax lint/pyright only when files
under samples/ change.
They intentionally do not run workspace pyright or mypy by default.
Ruff Configuration
- Line length: 120
- Target: Python 3.10+
- Auto-fix enabled
- Rules: ASYNC, B, CPY, D, E, ERA, F, FIX, I, INP, ISC, Q, RET, RSE, RUF, SIM, T20, TD, W, T100, S
- Scripts directory is excluded from checks
Pyright Configuration
- Strict mode enabled
- Excludes: tests, .venv, packages/devui/frontend
Parallel Execution
The task runner (scripts/task_runner.py) executes the cross-product of
(package × task) in parallel using ThreadPoolExecutor. Single items run
in-process with streaming output.
CI Workflow
CI splits into 4 parallel jobs:
- Pre-commit hooks — lightweight hooks (SKIP=poe-check)
- Package checks — syntax/pyright via check-packages
- Samples & markdown —
check -S plus markdown-code-lint
- Mypy — change-detected mypy checks
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: microsoft-agent-framework-python-code-quality3description: Python Code Quality4---56# Python Code Quality78## Quick Commands910All commands run from the `python/` directory:1112```bash13# Syntax formatting + checks (parallel across packages by default)14uv run poe syntax15uv run poe syntax -P core16uv run poe syntax -F # Format only17uv run poe syntax -C # Check only18uv run poe syntax -S # Samples only1920# Type checking21uv run poe pyright # Pyright fan-out across packages22uv run poe pyright -P core23uv run poe pyright -A24uv run poe mypy # MyPy fan-out across packages25uv run poe mypy -P core26uv run poe mypy -A27uv run poe typing # Both pyright and mypy28uv run poe typing -P core29uv run poe typing -A3031# All package-level checks in parallel (syntax + pyright)32uv run poe check-packages3334# Full check (packages + samples + tests + markdown)35uv run poe check36uv run poe check -P core3738# Samples only39uv run poe check -S40uv run poe pyright -S4142# Markdown code blocks43uv run poe markdown-code-lint44```4546## Pre-commit Hooks (prek)4748Prek hooks run automatically on commit. They stay lightweight and only check49changed files.5051```bash52# Install hooks53uv run poe prek-install5455# Run all hooks manually56uv run prek run -a5758# Run on last commit59uv run prek run --last-commit60```6162They run changed-package syntax formatting/checking, markdown code lint only63when markdown files change, and sample syntax lint/pyright only when files64under `samples/` change.65They intentionally do not run workspace `pyright` or `mypy` by default.6667## Ruff Configuration6869- Line length: 12070- Target: Python 3.10+71- Auto-fix enabled72- Rules: ASYNC, B, CPY, D, E, ERA, F, FIX, I, INP, ISC, Q, RET, RSE, RUF, SIM, T20, TD, W, T100, S73- Scripts directory is excluded from checks7475## Pyright Configuration7677- Strict mode enabled78- Excludes: tests, .venv, packages/devui/frontend7980## Parallel Execution8182The task runner (`scripts/task_runner.py`) executes the cross-product of83(package × task) in parallel using ThreadPoolExecutor. Single items run84in-process with streaming output.8586## CI Workflow8788CI splits into 4 parallel jobs:891. **Pre-commit hooks** — lightweight hooks (SKIP=poe-check)902. **Package checks** — syntax/pyright via check-packages913. **Samples & markdown** — `check -S` plus `markdown-code-lint`924. **Mypy** — change-detected mypy checks9394---95> Converted and distributed by [TomeVault](https://tomevault.io/claim/microsoft) — claim your Tome and manage your conversions.96<!-- tomevault:4.0:skill_md:2026-04-11 -->