[Django] #35527: Support `ruff format` as a formatter alongside `black`

9 views
Skip to first unread message

Django

unread,
Jun 16, 2024, 5:55:47 AM6/16/24
to django-...@googlegroups.com
#35527: Support `ruff format` as a formatter alongside `black`
-------------------------------------+-------------------------------------
Reporter: Aarni | Owner: nobody
Koskela |
Type: New | Status: new
feature |
Component: Core | Version:
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Django already has support for plugging in code formatters
(https://github.com/django/django/blob/fa7848146738a9fe1d415ee4808664e54739eeb7/django/core/management/utils.py#L160-L175)
for generated code (templates and migrations).

The ruff (https://github.com/astral-sh/ruff) project has a 99% black-
compatible formatter (https://astral.sh/blog/the-ruff-formatter) that's
very fast and increasingly popular.

It would be useful if Django could format migrations using `ruff format`
if available.

If this is welcome, I'm happy to write a PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/35527>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 16, 2024, 1:43:54 PM6/16/24
to django-...@googlegroups.com
#35527: Support `ruff format` as a formatter alongside `black`
-------------------------------------+-------------------------------------
Reporter: Aarni Koskela | Owner: nobody
Type: New feature | Status: closed
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* resolution: => wontfix
* status: new => closed
* version: => dev

Comment:

This was [https://forum.djangoproject.com/t/alternative-formatters-for-
generated-code-like-ruff-format/26127/4 discussed] on the forum without
reaching a consensus, so marking as "wontfix" for now.
--
Ticket URL: <https://code.djangoproject.com/ticket/35527#comment:1>
Reply all
Reply to author
Forward
0 new messages