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.
pip install wemake-python-styleguideVerified import paths — ran on the pinned version, not inferred.
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.
Ensure you install and configure 'ruff' (e.g., in `pyproject.toml`) and run `ruff format && ruff check` before `flake8 --select=WPS`. Review the v1.0.0 changelog for removed WPS codes.
Start with the default configuration, then systematically address or disable specific rules (e.g., using `# noqa` comments, `per-file-ignores`, or `ignore =` in `setup.cfg`) until your codebase passes. Refer to the documentation for each WPS code.
Always include `ruff format .`, `ruff check .`, and `flake8 --select=WPS .` in your CI/CD pipelines and local pre-commit hooks. Adjust configuration files (e.g., `pyproject.toml` for `ruff`, `setup.cfg` for `flake8`) to match.
Review your `flake8` configuration (`setup.cfg`, `.flake8`) and remove any `WPS` codes explicitly listed as removed in the v1.0.0 changelog. Use `ruff`'s corresponding rule codes instead where applicable.
Instead of sprinkling `# noqa` comments, try to refactor code to adhere to the style guide, or disable specific rules globally or per-file in your `setup.cfg` if they truly do not fit your project's needs.