From 574295d7744eeb684cb282a56865542bd67cf3cb Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Sat, 4 Apr 2026 10:50:09 -0700 Subject: [PATCH] [Docs] Enforce Black formatting in contributor docs Black formatting is now enforced in CI. Update CLAUDE.md, AGENTS.md, and CONTRIBUTING.md to instruct contributors and AI agents to run `poetry run black .` before committing, and add VS Code setup guidance. Co-Authored-By: Claude Opus 4.6 (1M context) --- AGENTS.md | 2 +- CLAUDE.md | 1 + CONTRIBUTING.md | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index ba9c9b356bc..37411938e2f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -254,7 +254,7 @@ See `CLAUDE.md` and the `Makefile` for standard commands. Key notes: - `openapi-core` must be installed (`poetry run pip install openapi-core`) for the OpenAPI compliance tests in `tests/test_litellm/interactions/`. - The `--timeout` pytest flag is NOT available; don't pass it. - Unit tests: `poetry run pytest tests/test_litellm/ -x -vv -n 4` -- Black `--check` may report pre-existing formatting issues; this does not block test runs. +- **Before committing, always run `poetry run black .` to format your code.** Black formatting is enforced in CI. - If `poetry install` fails with "pyproject.toml changed significantly since poetry.lock was last generated", run `poetry lock` first to regenerate the lock file. ### Lint diff --git a/CLAUDE.md b/CLAUDE.md index f0478120181..a8800ff8884 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,6 +20,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co - `make format` - Apply Black code formatting - `make lint-ruff` - Run Ruff linting only - `make lint-mypy` - Run MyPy type checking only +- **Before committing, always run `poetry run black .` to format your code.** Black formatting is enforced in CI. ### Single Test Files - `poetry run pytest tests/path/to/test_file.py -v` - Run specific test file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77bc15ff50b..c029ccce1ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -149,6 +149,19 @@ Apply formatting (auto-fixes issues): make format ``` +> **Black formatting is enforced in CI.** All PRs must pass the Black formatting check. +> +> - **AI coding agents** (Claude Code, Copilot, Cursor, etc.): `AGENTS.md` and `CLAUDE.md` instruct agents to run `poetry run black .` before committing. +> - **VS Code users**: Install the [Black Formatter extension](https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter) and enable format-on-save: +> ```json +> { +> "[python]": { +> "editor.defaultFormatter": "ms-python.black-formatter", +> "editor.formatOnSave": true +> } +> } +> ``` + ### CI Compatibility To ensure your changes will pass CI, run the exact same checks locally: