Flake8-pyproject / flake8p
Runs Flake8 with configuration from pyproject.toml
Flake8 cannot be configured via pyproject.toml, even though
virtually all other Python dev tools have adopted it as the central
location for project configuration. The discussion of the original
proposal (#234) was closed as "too heated", subsequent feature
and pull requests were marked as "spam" (#1332, #1421, #1431,
#1447, #1501).
Flake8-pyproject also has bad manners and force-feeds Flake8 the spam it so despises. It is inspired by pyproject-Flake8, which had received little maintenance following its initial commit. The code was however completely rewritten and a simple test suite makes it all a little more palatable.
Usage
Say your Flake8 configuration in .flake8 (or in tox.ini, or
setup.cfg) is this:
[flake8]
ignore = E231, E241
per-file-ignores =
__init__.py:F401
max-line-length = 88
count = true
Copy that [flake8] section to pyproject.toml, rename it as
[tool.flake8], and convert the key–value pairs to the TOML format:
[tool.flake8]
ignore = ['E231', 'E241']
per-file-ignores = [
'__init__.py:F401',
]
max-line-length = 88
count = true
From then on run flake8p instead of flake8 to lint the code so
that the configuration in pyproject.toml will be used.
Implementation
Flake8 uses RawConfigParser from the standard library to parse its
configuration files, and therefore expects them to have the INI format.
This library adds pyproject.toml to Flake8's list of acceptable
configuration files and monkey-patches Flake8's RawConfigParser class
definition so that, when pyproject.toml is being read, the format is
converted from TOML to INI on the fly. TOML parsing is handled by
Tomli, which will be part of the standard library as of Python 3.11
(PEP 680).
A few very simple integration tests round out the package, making sure that any one of the possible configuration files are in fact accepted.
Release files for Flake8-pyproject 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Flake8_pyproject-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / Flake8_pyproject-0.9.0-py3-none-any.whl
| Download URL | Flake8_pyproject-0.9.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9974c11c9f39b26e15eb6d79d9ffe840637648f5b6f0f844f0bb70f0b691917a
|
|
BLAKE2b-256 checksum How to use checksums |
5e39f6c8098f12b6d7a4e35652a9ac3ce87a2b01bbdb35ac1833af2ccb3106e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.27.1
|