Skip to content

dprint/dprint-plugin-ruff

Repository files navigation

dprint-plugin-ruff

CI

Adapter for Ruff for use as a formatting plugin in dprint.

Formats .py and .pyi files.

Note: For formatting .ipynb files, use the Jupyter plugin along with this plugin.

Install

Install and setup dprint.

Then in your project's directory with a dprint.json file, run:

dprint config add ruff

Configuration

To add configuration, specify a "ruff" key in your dprint.json:

{
  "ruff": {
    "indentStyle": "space",
    "lineLength": 100,
    "indentWidth": 2
  },
  "plugins": [
    // ...etc...
  ]
}

For an overview of the config, see https://dprint.dev/plugins/ruff/config/

JS Formatting API

Versioning

This repo automatically upgrades to the latest version of Ruff once a day. You can check which version of Ruff is being used by looking at the tag property in the ruff_python_formatter entry in the Cargo.toml file in this repo:

https://github.com/dprint/dprint-plugin-ruff/blob/main/Cargo.toml

At the moment, the version of this plugin does not reflect the version of Ruff. This is just in case there are any small bug fixes that need to be made as this plugin is quite new. After a while I'll try to match the versions.