Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify per-file-ignores with pyproject.toml and flake8

I am using flake8 (with flakehell but that should not interfere) and keep its configuration in a pyproject.toml file. I want to add a per-file-ignores config but nothing works and there is no documentation on how it is supposed to be formatted in a toml file.

Flake8 docs show only the 'native' config file format:

per-file-ignores =
    project/__init__.py:F401
    setup.py:E121
    other_project/*:W9

There is no description / example for pyproject.toml.

I tried:

per-file-ignores=["file1.py:W0621", "file2.py:W0621"]

and

per-file-ignores={"file1.py" = "W0621", "file2.py" = "W0621"}

both of which silently fail and have no effect (the warning is still raised).

What is the proper syntax for per-file-ignores setting in flake8/flakehell while using pyproject.toml?

like image 434
Piotr Zakrzewski Avatar asked Sep 07 '25 14:09

Piotr Zakrzewski


1 Answers

flake8 does not have support for pyproject.toml, only .flake8, setup.cfg, and tox.ini


disclaimer: I am the flake8 maintainer

like image 50
Anthony Sottile Avatar answered Sep 09 '25 03:09

Anthony Sottile