PyCharm¶
There are three ways to use wemake-python-styleguide inside
PyCharm:
A custom File Watcher configured to run
flake8with WPS enabledAn LSP server via
python-lsp-server(requires LSP4IJ)
The File Watcher approach is useful when you want real-time feedback on every file save or when the plugin does not pick up your WPS installation. The LSP approach provides the richest IDE integration with inline diagnostics, hover tooltips, and quick fixes.
Prerequisites¶
Make sure you have wemake-python-styleguide installed.
We recommend using uv:
uv tool install --with-executables-from flake8 wemake-python-styleguide
After installation the flake8 binary is available on your PATH
(usually at ~/.local/bin/flake8 on Linux and macOS).
Setting up a File Watcher¶
Open Settings (or Preferences on macOS).
Navigate to Tools → File Watchers.
Click + and choose <custom>.
Configure the watcher:
Name:
wemake-python-styleguideFile type:
PythonScope:
Project FilesProgram:
flake8(or the full path from above)Arguments:
--select=WPS $FilePath$Output paths to refresh:
$FilePath$Working directory:
$ProjectFileDir$
In the Advanced Options section enable:
Auto-save edited files to trigger the watcher
Trigger the watcher on external changes
Click OK.
The watcher will run WPS on every save and show violations directly in the PyCharm editor and in the Inspections panel.
Setting up an LSP server¶
This method uses python-lsp-server together with the LSP4IJ plugin
to provide inline error highlighting, hover information, and more.
Install the LSP4IJ plugin
Go to Settings → Plugins → Marketplace, search for LSP4IJ and install it.
Install ``python-lsp-server``
We recommend using uv:
uv tool install \ --with flake8 \ --with wemake-python-styleguide \ --with pyls-flake8 \ python-lsp-server
After installation the
pylspbinary is available on yourPATH(usually at~/.local/bin/pylspon Linux and macOS).Find the ``pylsp`` executable
Run
where pylsp(orwhich pylsp) and note the full path.Create a new LSP server definition
Open Settings → Languages & Frameworks → Language Server Protocol → Server Definitions.
Click + to add a new server.
Set Name to
pylsp-wpsand Path to thepylspexecutable from step 3.Switch to the Configuration tab and paste:
{ "pylsp": { "plugins": { "flake8": { "enabled": true, "select": ["WPS", "E"] }, "pycodestyle": { "enabled": false }, "pyflakes": { "enabled": false }, "mccabe": { "enabled": false } } } }
In Mappings add
Pythonas the language for this server.Click OK.
Restart PyCharm
Restart the IDE completely so the LSP server can initialise.
Verify
Open a Python file and introduce an intentional WPS violation. You should see inline squiggles and hover tooltips with the violation message.
Troubleshooting¶
If you do not see any violations:
Make sure the Program path points to the
flake8binary that haswemake-python-styleguideinstalled inside the same environment.Try running the same command from the terminal to verify it works.
Check that your project has a valid
setup.cfgorpyproject.tomlwith WPS configuration.