Configure flake8 via pyproject.toml. Supports local plugins.
This flake8 plugin adds support for loading the flake8 configuration from pyproject.toml files, including loading local plugins.
The plugin will automatically find a pyproject.toml file in the current working directory where flake8 is run from. It also overrides the --config CLI option so that a TOML file can be specified to load the config from:
flake8 --config custom.toml
flake8-toml-config will respect the --isolated flag.
Note that this plugin replaces flake8’s built-in support for other config file formats. While the plugin is installed, config can only be read from TOML files.
Table of contents
Configuration translation
Below is an example of a flake8 configuration as it would appear in a .flake8 file:
[flake8]
max-line-length = 80
extend-select = B950
extend-ignore = E203,E501,E701
[flake8:local-plugins]
paths = ./assets/flake8
extension =
CL1 = custom_repo_linter:Plugin1
CL2 = custom_repo_linter:Plugin2
reporter =
CR = custom_repo_reporter:Plugin
Below is the equivalent configuration, suitable for use in a pyproject.toml file. Note that the flake8:local-plugins section requires quotes in the TOML format:
[tool.flake8]
max-line-length = 80
extend-select = ["B950"]
extend-ignore = ["E203", "E501", "E701"]
[tool."flake8:local-plugins"]
paths = ["./assets/flake8"]
extension.CL1 = "custom_repo_linter:Plugin1"
extension.CL2 = "custom_repo_linter:Plugin2"
reporter.CR = "custom_repo_reporter:Plugin"
Alternatively, multi-line TOML strings can be used for clearer config parity:
# ...
[tool."flake8:local-plugins"]
paths = ["./assets/flake8"]
extension = """
CL1 = custom_repo_linter:Plugin1
CL2 = custom_repo_linter:Plugin2
"""
reporter = """
CR = custom_repo_reporter:Plugin
"""
pipx usage
If flake8 is installed using pipx, you can inject this plugin:
pipx inject flake8 flake8-toml-config
pre-commit usage
Add this plugin as an additional dependency:
- repo: "https://github.com/pycqa/flake8"
rev: "7.3.0"
hooks:
- id: "flake8"
additional_dependencies:
- "flake8-toml-config==1.0.0"
Note that the pre-commit autoupdate command, and pre-commit.ci, do not update additional dependencies. Consider using upadup to auto-update additional dependencies as needed.
Release files for flake8-toml-config 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flake8_toml_config-1.0.0.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_toml_config-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.1 kB
Release files / flake8_toml_config-1.0.0.tar.gz
| Download URL | flake8_toml_config-1.0.0.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6665039caf44339ea12d83e61ba00a698039f5ae1e20c0202a96caa9d0963773
|
|
BLAKE2b-256 checksum How to use checksums |
6569df6e0524e3f6eb0dd2d4e6ce58eed7a54c6b6054adeec82b1e352eec3fe2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / flake8_toml_config-1.0.0-py3-none-any.whl
| Download URL | flake8_toml_config-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
009251427c3137df8409bc58adee83d473b5e693765725fafbfb9f647e929982
|
|
BLAKE2b-256 checksum How to use checksums |
dfda70bf88772f1668300ce0b8cab3e90d4c7ec94c830fc3a4eb0859206467e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|