Python tools support
PyCharm supports several tools to improve code quality, maintainability, and workflow efficiency:
Ruff: a high-performance linter and formatter that detects errors and enforces coding standards.
Pyright (and basedpyright), Pyrefly, ty: fast type checkers providing real-time type analysis.
Black: an automatic code formatter that helps maintain a consistent style.
Ruff
Ruff can highlight issues as you type, suggest fixes, and help maintain consistent code quality across your project. It runs quickly and provides real-time feedback directly in your editor.
Ruff support in PyCharm includes:
Formatting
Import optimization
Quick fixes
Configuration file validation
Inlay hints for error codes

Completions for error codes and configuration options

Web links for error codes and configuration options

In-editor documentation preview for error codes and configuration options

Configure Ruff
Go to in the Settings dialog (Ctrl+Alt+S) .
Select the Enable checkbox to start configuring Ruff settings.
In the Execution mode setting, select how PyCharm should search for the Ruff executable:
Interpreter mode: PyCharm searches for a Ruff executable installed in your interpreter. To install the Ruff package for the selected interpreter, click Install Ruff.
Path mode: PyCharm searches for a Ruff executable in
$PATH. If the executable is not found, you can specify the path by clicking theBrowse... icon.
Select which Ruff options should be enabled:
Click All actions on save... to configure additional options. If Ruff integration is enabled in the settings, it will be used when you run or .

Ruff settings can also be configured using a
pyproject.toml,ruff.toml, or.ruff.tomlfile. For more information, refer to the Ruff documentation.

Pyrefly
Pyrefly is a type checker and language server for Python.
Configure Pyrefly
Go to in the Settings dialog (Ctrl+Alt+S) .
Select the Enable checkbox to start configuring Pyrefly settings.
In the Execution mode setting, select how PyCharm should search for the Pyrefly executable:
Interpreter mode: PyCharm searches for a Pyrefly executable installed in your interpreter. To install the Pyrefly package for the selected interpreter, click Install Pyrefly.
Path mode: PyCharm searches for a Pyrefly executable in
$PATH. If the executable is not found, you can specify the path by clicking theBrowse... icon.
Select which Pyrefly options should be enabled:
Pyrefly settings can be configured using a
pyrefly.tomlorpyproject.tomlfile. For more information, refer to the Pyrefly documentation.

Pyright and basedpyright
Pyright is a static type checker for Python.
basedpyright is a fork of Pyright with various type checking improvements.
Configure Pyright
Go to in the Settings dialog (Ctrl+Alt+S) .
Select the Enable checkbox to start configuring Pyright settings.
In the Execution mode setting, select how PyCharm should search for the Pyright executable:
Interpreter mode: PyCharm searches for a Pyright executable installed in your interpreter. To install the basedpyright package for the selected interpreter, click Install basedpyright.
If you want to use plain Pyright, install
pyright[nodejs].Path mode: PyCharm searches for a Pyright executable in
$PATH. If the executable is not found, you can specify the path by clicking theBrowse... icon.
Select which Pyright options should be enabled:
Inlay hints (available for basedpyright only)
Pyright settings can be configured using a
pyrightconfig.jsonorpyproject.tomlfile. For more information, refer to the Pyright and basedpyright documentation.

ty
ty is a fast Python type checker, written in Rust. It is currently in preview and could be incomplete.
Configure ty
Go to in the Settings dialog (Ctrl+Alt+S) .
Select the Enable checkbox to start configuring ty settings.
In the Execution mode setting, select how PyCharm should search for the ty executable:
Interpreter mode: PyCharm searches for a ty executable installed in your interpreter. To install the ty package for the selected interpreter, click Install ty.
Path mode, PyCharm searches for a ty executable in
$PATH. If the executable is not found, you can specify the path by clicking theBrowse... icon.
Select which ty options should be enabled:
ty settings can be configured using a
pyproject.tomlorty.tomlfile. For more information, refer to the ty documentation.

Black
You can use Black to format your Python code in PyCharm.
Configure Black
Go to in the Settings dialog (Ctrl+Alt+S) .
In the Execution mode drop-down, select how PyCharm should run the Black formatter:
Binary mode: PyCharm uses the Black executable installed in your system. If the executable is not found, you can specify the path by clicking the
Browse... icon:

Package mode: PyCharm uses the Black package installed in the project interpreter. To install the Black package for the selected interpreter, click Install Black:

Select when do you want to run the Black formatter:
Enable the On code reformat checkbox to use Black instead of the built-in formatter when you press Ctrl+Alt+L or select from the main menu.
Select On save if you want to run Black formatter automatically when your changes are saved. To configure additional actions, click All actions on save....
The settings of the Black formatter can be configured in a
pyproject.tomlfile. For Black v21.4.0 and higher, they are applied automatically. For more information, refer to the Black documentation.You can also use the Settings field to specify additional options or override the settings from
pyproject.toml:
For more information, refer to the Black CLI reference.