Summary
Propose migrating from Black to Ruff as the default formatter for significantly improved performance.
Motivation
Performance Benchmarks
Tested with a 2000-definition schema (3 runs average):
| Formatter |
Format Time |
Improvement |
| Black + isort |
2.355s |
(baseline) |
| Ruff format + isort |
0.487s |
79% faster |
| Ruff format only |
0.243s |
90% faster |
Total processing time improvement: 29-33%
For large schemas (like Kubernetes CRDs with 10,000+ definitions), formatting can be a major bottleneck. This change would significantly improve the user experience for large-scale code generation.
Adoption Statistics (December 2025)
| Package |
Monthly Downloads |
GitHub Stars |
| ruff |
111M |
44.7k |
| black |
90M |
41.2k |
Ruff has surpassed Black in downloads and is now used by major projects including:
- Pydantic (our primary output format)
- FastAPI, Pandas, PyTorch, Hugging Face, Apache Airflow, and 118,000+ other projects
Compatibility
Ruff formatter achieves >99.9% compatibility with Black (source).
Proposal
Phase 1: Documentation + Deprecation Warning
-
Update documentation to recommend Ruff as the preferred formatter
- Add migration guide
- Document performance benefits
-
Add DeprecationWarning when Black formatter is used
warnings.warn(
"Black formatter is deprecated and will be removed in a future version. "
"Consider using --formatters ruff-format for better performance.",
DeprecationWarning,
)
Phase 2: Change Default (Future Major Release)
- Change
DEFAULT_FORMATTERS from [black, isort] to [ruff-format]
- Users can still use
--formatters black,isort for the original behavior
Considerations
Related
Feedback welcome via comments or reactions.
Summary
Propose migrating from Black to Ruff as the default formatter for significantly improved performance.
Motivation
Performance Benchmarks
Tested with a 2000-definition schema (3 runs average):
Total processing time improvement: 29-33%
For large schemas (like Kubernetes CRDs with 10,000+ definitions), formatting can be a major bottleneck. This change would significantly improve the user experience for large-scale code generation.
Adoption Statistics (December 2025)
Ruff has surpassed Black in downloads and is now used by major projects including:
Compatibility
Ruff formatter achieves >99.9% compatibility with Black (source).
Proposal
Phase 1: Documentation + Deprecation Warning
Update documentation to recommend Ruff as the preferred formatter
Add DeprecationWarning when Black formatter is used
Phase 2: Change Default (Future Major Release)
DEFAULT_FORMATTERSfrom[black, isort]to[ruff-format]--formatters black,isortfor the original behaviorConsiderations
ruffas a required dependency (currently optional)Related
_get_unique_nametake really long with large swagger definition file #2286Feedback welcome via comments or reactions.