Flake8-pyproject

1.2.4 · active · verified Fri Apr 10

Flake8-pyproject is a Flake8 plugin that enables Flake8 to load its configuration from `pyproject.toml` files, a feature not natively supported by Flake8. It registers itself as a plugin, allowing the standard `flake8` command to seamlessly use `pyproject.toml` when present in the current directory. The library also provides an alternative `flake8p` command. It is currently at version 1.2.4 and receives updates primarily for Flake8 compatibility and new configuration options.

Warnings

Install

Quickstart

This quickstart demonstrates how to install `flake8-pyproject`, configure Flake8 via `pyproject.toml`, and then run the `flake8` command to apply those configurations. The `flake8` command will automatically pick up the `[tool.flake8]` section from your `pyproject.toml`.

mkdir my_project
cd my_project
pip install flake8 Flake8-pyproject

# Create pyproject.toml
cat <<EOF > pyproject.toml
[tool.flake8]
ignore = ["E203", "W503"]
max-line-length = 88
per-file-ignores = [
    "__init__.py:F401",
]
EOF

# Create a Python file with a linter error
cat <<EOF > my_module.py
import os

def my_func (  arg1, arg2 ):
    return arg1 + arg2

EOF

# Run flake8 (will use pyproject.toml config)
flake8 my_module.py

# Alternatively, use the provided flake8p command
# flake8p my_module.py

view raw JSON →