This Emacs library provides commands and a minor mode for easily reformatting Python source code using Ruff.
If you choose not to use one of the convenient packages in MELPA, you'll need to add the directory containing ruff-format.el to your load-path, and then (require 'ruff-format).
reformatter is required.
Customise the ruff-format-command variable as desired, then call ruff-format-buffer or ruff-format-region as convenient.
Enable ruff-format-on-save-mode in Python mode buffers like this:
(add-hook 'python-mode-hook 'ruff-format-on-save-mode)...or locally to your project with a form in your .dir-locals.el like this:
((python-mode (mode . ruff-format-on-save)))SPDX-License-Identifier: GPL-3.0-or-later