wemake-python-styleguide

1.6.1 · active · verified Thu Apr 16

wemake-python-styleguide is an extremely strict and opinionated Python linter, acting as a flake8 plugin and a companion to ruff. It aims to enforce consistent, maintainable, and less complex code, often surpassing standard PEP8 checks with its extensive rule set. The library is actively maintained with frequent minor releases, currently at version 1.6.1, and supports Python 3.10 and newer.

Common errors

Warnings

Install

Imports

Quickstart

Install `wemake-python-styleguide` alongside `flake8` and `ruff`. Create a `pyproject.toml` (for Ruff configuration) and/or `setup.cfg` (for Flake8 configuration, including `--select=WPS`). The recommended workflow involves running `ruff format`, `ruff check`, and then `flake8 --select=WPS` sequentially. This ensures Ruff handles most style and formatting, leaving wemake-python-styleguide to apply its unique opinionated rules.

pip install wemake-python-styleguide flake8 ruff

# --- pyproject.toml ---
# [tool.ruff]
# line-length = 88 # Or your preferred length
# target-version = "py310"
#
# [tool.flake8]
# select = "WPS"
# max-complexity = 10
# max-line-length = 88

# Run ruff first for formatting and many common lints
ruff format .
ruff check .

# Then run wemake-python-styleguide specific checks via flake8
flake8 --select=WPS .

view raw JSON →