# Alternative formatters for generated code, like \`ruff format\`?

**URL:** <https://forum.djangoproject.com/t/alternative-formatters-for-generated-code-like-ruff-format/26127>\
**Category:** Django Internals\
**Created:** [December 13, 2023, 10:55am UTC](https://forum.djangoproject.com/t/alternative-formatters-for-generated-code-like-ruff-format/26127 "2023-12-13T10:55:20Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![tom](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/tom/32/6818_2.png) [@tom](https://forum.djangoproject.com/u/tom)\
**Post date:** [March 10, 2025, 10:43am UTC](https://forum.djangoproject.com/t/alternative-formatters-for-generated-code-like-ruff-format/26127/21 "2025-03-10T10:43:13Z")

</div>

For linting rather than formatting, but:

In case this could nudge things in the direction of Ruff, I did come across a ticket today where Ruff has its own rule that would be useful: [#36215 (Update Python code style in contribution docs to mention using PEP 448 unpacking to concatenate iterables) – Django](https://code.djangoproject.com/ticket/36215#comment:6)

I don’t know if it’s enough to move the needle. But I do think Ruff is starting to look like a better option than sticking with Flake8, isort, and black, all running separately and quite slowly.

---

<div class="post-metadata">

**Author:** ![jvacek](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jvacek/32/30043_2.png) [@jvacek](https://forum.djangoproject.com/u/jvacek)\
**Post date:** [September 25, 2025, 5:29pm UTC](https://forum.djangoproject.com/t/alternative-formatters-for-generated-code-like-ruff-format/26127/22 "2025-09-25T17:29:11Z")

</div>

I threw this together in the meantime if anyone is interested [django-migrations-ruff-formatter · PyPI](https://pypi.org/project/django-migrations-ruff-formatter/)

---

<div class="post-metadata">

**Author:** ![washeck](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/washeck/32/700_2.png) [@washeck](https://forum.djangoproject.com/u/washeck)\
**Post date:** [September 30, 2025, 8:28am UTC](https://forum.djangoproject.com/t/alternative-formatters-for-generated-code-like-ruff-format/26127/23 "2025-09-30T08:28:15Z")

</div>

Or you can just use this tiny script

```auto
#!/bin/bash

if ["$1" == "--fast"]; then
	shift
fi

ruff format $@

```

and store it as `black` somewhere in your shell search path.

---

<div class="post-metadata">

**Author:** ![jvacek](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jvacek/32/30043_2.png) [@jvacek](https://forum.djangoproject.com/u/jvacek)\
**Post date:** [September 30, 2025, 9:21am UTC](https://forum.djangoproject.com/t/alternative-formatters-for-generated-code-like-ruff-format/26127/24 "2025-09-30T09:21:31Z")

</div>

that won’t really scale that easily across a team or contributors

[Previous page](https://forum.djangoproject.com/t/alternative-formatters-for-generated-code-like-ruff-format/26127.md?page=1)
