Skip to content

Commit ebe459d

Browse files
MaxGhenisclaude
andauthored
Replace black formatter references with ruff (#109)
* Replace black formatter references with ruff in skills and commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Replace remaining black formatter references with ruff format Update agent docs (pr-pusher, rules-engineer, ci-fixer) and policyengine-core-skill to use ruff format instead of black. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add changelog fragment --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 60c2afc commit ebe459d

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

agents/country-models/ci-fixer.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,16 @@ policyengine-core test policyengine_us/tests/policy/baseline/gov/states/ar/dhs/t
243243

244244
#### Linting/Formatting
245245
```bash
246-
# CRITICAL: Use uv run to ensure correct black version from uv.lock
246+
# CRITICAL: Use uv run to ensure correct ruff version from uv.lock
247247
# This matches CI exactly
248248
uv sync --extra dev
249-
uv run black . -l 79
249+
uv run ruff format
250250

251-
# DO NOT use bare 'black' command - may use wrong version!
251+
# DO NOT use bare 'ruff' command - may use wrong version!
252252

253253
# Commit formatting fixes
254254
git add -A
255-
git commit -m "Fix: Apply black formatting"
255+
git commit -m "Fix: Apply ruff formatting"
256256
git push
257257
```
258258

@@ -513,7 +513,7 @@ gh pr edit --add-reviewer @reviewer-username
513513

514514
## Common CI Issues and Fixes
515515

516-
### 1. Black Formatting
516+
### 1. Ruff Formatting
517517
**Error**: `would reformat file.py`
518518
**Fix**: Run `make format` and commit
519519

agents/country-models/pr-pusher.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ This ensures you have the complete patterns and standards loaded for reference t
4343
## CRITICAL: Version Sync
4444

4545
**Always use `uv run` for Python tools to ensure versions match CI:**
46-
- `uv run black . -l 79` - NOT `black . -l 79`
46+
- `uv run ruff format` - NOT `ruff format`
4747
- `uv run isort .` - NOT `isort .`
4848
- `uv run pytest` - NOT `pytest`
4949

@@ -76,14 +76,14 @@ python -c "import yaml; yaml.safe_load(open('changelog_entry.yaml'))" || exit 1
7676
### Step 2: Run Formatters
7777

7878
```bash
79-
# CRITICAL: Use uv to ensure correct black version from uv.lock
79+
# CRITICAL: Use uv to ensure correct ruff version from uv.lock
8080
# This matches CI exactly - both use the pinned version
8181

8282
# First ensure dependencies are installed
8383
uv sync --extra dev
8484

8585
# Format Python code using uv run to use locked version
86-
uv run black . -l 79
86+
uv run ruff format
8787

8888
# Also run linecheck if available
8989
uv run linecheck . --fix 2>/dev/null || true
@@ -96,7 +96,7 @@ git add -A
9696
if ! git diff --cached --quiet; then
9797
git commit -m "Apply code formatting
9898
99-
- Run black with 79 char line length (from uv.lock)
99+
- Run ruff format (from uv.lock)
100100
- Fix import ordering
101101
- Apply standard formatting rules"
102102
fi
@@ -117,7 +117,7 @@ if grep -q "error:" lint_output.txt; then
117117
autoflake --remove-all-unused-imports --in-place --recursive .
118118

119119
# Fix import order
120-
isort . --profile black --line-length 79
120+
isort . --profile ruff --line-length 79
121121

122122
# Commit fixes
123123
git add -A
@@ -182,7 +182,7 @@ $DESCRIPTION
182182
183183
## Checklist
184184
- [ ] Changelog entry added
185-
- [ ] Code formatted with black
185+
- [ ] Code formatted with ruff format
186186
- [ ] Linting passes
187187
- [ ] Tests pass locally
188188
- [ ] CI checks pass
@@ -234,18 +234,18 @@ fi
234234
235235
```bash
236236
# Fix with isort
237-
isort . --profile black --line-length 79
237+
isort . --profile ruff --line-length 79
238238
```
239239

240-
### Black Formatting
240+
### Ruff Formatting
241241

242242
```bash
243-
# CRITICAL: Use uv run to ensure correct black version from uv.lock
243+
# CRITICAL: Use uv run to ensure correct ruff version from uv.lock
244244
# This ensures local formatting matches CI exactly
245-
uv sync --extra dev # Ensure black is installed
246-
uv run black . -l 79
245+
uv sync --extra dev # Ensure ruff is installed
246+
uv run ruff format
247247

248-
# DO NOT use bare 'black' command - it may use wrong version!
248+
# DO NOT use bare 'ruff' command - it may use wrong version!
249249
```
250250

251251
### Unused Imports

agents/country-models/rules-engineer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,8 @@ Run through the skill's Quick Checklist before finalizing.
533533
# CRITICAL: Use uv run to ensure correct tool versions from uv.lock
534534
uv sync --extra dev # Ensure all dev dependencies installed
535535

536-
# Format code using locked black version
537-
uv run black . -l 79
536+
# Format code using locked ruff version
537+
uv run ruff format
538538

539539
# Run tests to verify implementation
540540
uv run pytest policyengine_us/tests/policy/baseline/gov/states/STATE/ -v --maxfail=5
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update skill and agent references from black to ruff format.

commands/encode-reform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ Validate the reform implementation. Check this reform-specific checklist:
339339
Also check standard code quality:
340340
- Parameter metadata complete (unit, period, label, reference)
341341
- Variable patterns correct (adds vs add(), entity levels)
342-
- Code style (black formatting, import ordering)
342+
- Code style (ruff formatting, import ordering)
343343
- Reference format (title with full section, href with #page=XX)
344344
345345
Write {PREFIX}-checkpoint.md (≤15 lines):

skills/documentation/policyengine-standards-skill/SKILL.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: policyengine-standards
33
description: |
44
PolicyEngine coding standards, formatters, CI requirements, and development best practices.
5-
Triggers: "CI failing", "linting", "formatting", "before committing", "PR standards", "code style", "black formatter", "prettier", "pre-commit"
5+
Triggers: "CI failing", "linting", "formatting", "before committing", "PR standards", "code style", "ruff formatter", "prettier", "pre-commit"
66
---
77

88
# PolicyEngine Standards Skill
@@ -152,16 +152,16 @@ bun test -- --watch # Watch mode
152152
## Python Standards
153153

154154
### Formatting
155-
- **Formatter**: Black with 79-character line length
156-
- **Command**: `make format` or `black . -l 79`
157-
- **Check without changes**: `black . -l 79 --check`
155+
- **Formatter**: Ruff
156+
- **Command**: `make format` or `ruff format .`
157+
- **Check without changes**: `ruff format --check .`
158158

159159
```bash
160160
# Format all Python files
161161
make format
162162

163163
# Check if formatting is needed (CI-style)
164-
black . -l 79 --check
164+
ruff format --check .
165165
```
166166

167167
### Code Style
@@ -350,7 +350,7 @@ If the renamed repo is embedded in another site (e.g., via iframe or GitHub Page
350350
## Resources
351351

352352
- **Main CLAUDE.md**: `/PolicyEngine/CLAUDE.md`
353-
- **Python Style**: PEP 8, Black documentation
353+
- **Python Style**: PEP 8, Ruff documentation
354354
- **React Style**: Airbnb React/JSX Style Guide
355355
- **Testing**: pytest documentation, Jest/RTL documentation
356356
- **Writing Style**: See policyengine-writing-skill for blog posts, PR descriptions, and documentation

skills/tools-and-apis/policyengine-core-skill/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,6 @@ sim.calculate("variable", period)
527527

528528
**Development standards:**
529529
- Python 3.10-3.13
530-
- Black formatting (79-char)
530+
- Ruff formatting (79-char)
531531
- Comprehensive tests
532532
- No breaking changes without discussion

0 commit comments

Comments
 (0)