forge-format

A unified, opinionated code formatting command for Django projects.

Uses black and ruff to format Python code.

Installation

First, install forge-format from PyPI:

pip install forge-format

Now you will have access to the format command:

forge format

Note that if you're using black + ruff for the first time, a common issue is to get a bunch of E501 Line too long errors on code comments. This is because black doesn't fix line lengths on comments! If there are more than you want to fix, just add this to your pyproject.toml:

[tool.ruff]
# Never enforce `E501` (line length violations).
ignore = ["E501"]