From d790aa31eb274db518dd48691c31de2fde0ebacd Mon Sep 17 00:00:00 2001 From: "Billy D." Date: Mon, 2 Feb 2026 08:45:33 -0500 Subject: [PATCH] docs: add ruff linting/formatting conventions for Python repos --- CODING-CONVENTIONS.md | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/CODING-CONVENTIONS.md b/CODING-CONVENTIONS.md index cc6ebf9..67812f1 100644 --- a/CODING-CONVENTIONS.md +++ b/CODING-CONVENTIONS.md @@ -88,6 +88,54 @@ uv lock uv run pytest ``` +### Code Formatting & Linting (Ruff) + +All Python code must pass `ruff check` and `ruff format` before merge. Ruff is configured in each repo's `pyproject.toml`: + +```toml +[tool.ruff] +line-length = 100 +target-version = "py311" + +[tool.ruff.lint] +select = ["E", "F", "W", "I", "UP", "B", "C4", "SIM"] +ignore = ["E501"] # Line length handled by formatter + +[tool.ruff.format] +quote-style = "double" +``` + +**Required dev dependency:** +```toml +[project.optional-dependencies] +dev = [ + "pytest>=8.0.0", + "pytest-asyncio>=0.23.0", + "pytest-cov>=4.0.0", # For coverage in handler-base + "ruff>=0.1.0", +] +``` + +**Local workflow:** +```bash +# Check and auto-fix +uv run ruff check --fix . + +# Format code +uv run ruff format . + +# Verify before commit +uv run ruff check . && uv run ruff format --check . +``` + +**CI enforcement:** All repos run ruff in the lint job. Commits that fail linting will not pass CI. + +**Kubeflow pipeline variables:** For Kubeflow DSL pipelines, terminal task assignments that appear unused should have `# noqa: F841` comments, as these define the DAG structure: +```python +# Step 6: Final step (defines DAG dependency) +tts_task = synthesize_speech(text=llm_task.output) # noqa: F841 +``` + ### Project Structure ```python