Skip to main content

Flake8 plug-in loading the configuration from pyproject.toml

Project description

Flake8-pyproject

Flake8 plug-in loading the 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 registers itself as a Flake8 plug-in to seamlessly load the configuration from pyproject.toml when you run the flake8 command.

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

Then run flake8 in the project root folder, where pyproject.toml is located.

In case your TOML-based configuration is contained in a different folder, or the file has a different name, specify the location with the --toml-config command-line option.

For compatibility with earlier versions of this package, and perhaps extra reliability in terms of possible future breakage of the plug-in hook, the package also provides a flake8p command that could be called alternatively to lint the code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

flake8_pyproject-1.2.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file flake8_pyproject-1.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_pyproject-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6249fe53545205af5e76837644dc80b4c10037e73a0e5db87ff562d75fb5bd4a
MD5 52f36943513a9f97829e29040df15c07
BLAKE2b-256 5f1d635e86f9f3a96b7ea9e9f19b5efe17a987e765c39ca496e4a893bb999112

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page