formate is configured using the formate.toml file in the root of your project (alongside, tox.ini etc.). The file uses the TOML syntax, built around a top-level mapping of two keys. The -c / --config-file option can be used to point to a file with a different name, but at this time the file must be TOML and must have the same layout.

The two top-level keys are hooks and config.


This is a mapping of hook names to their settings. The values can be either:

  • an integer, representing the priority of the hook.

  • a mapping of the following:

    • priority – an integer, representing the priority of the hook.

    • args – a list of positional arguments to pass to the hook function. Optional. Default ().

    • kwargs – a mapping of keyword arguments to pass to the hook. Optional. Default {}.

The TOML syntax allows for the mapping to spread over multiple tables, like so:

reformat-generics = 40
collections-import-rewrite = 20
noqa-reformat = 60
ellipsis-reformat = 70

priority = 50

multi_line_output = 8
use_parentheses = true
remove_redundant_aliases = true


This is a mapping of general configuration settings, which hooks can use as they please. Common keys include indent, indicating the type of indent to use, and line_length, indicating how long lines may be.


indent = "\t"
line_length = 115

Alternatively the configuration may be placed in the pyproject.toml file defined in PEP 518. The only difference is that hooks and config become tool.formate.hooks and tool.formate.config. You must also pass --config-file pyproject.toml on the command line.