According to the docs,

PyCharm adheres to PEP8 rules and requirements for arranging and formatting Python code.

From how I understand it, there is still some flexibility under pep8.

For example, the default formatter on Pycharm allows for use of single or double quotes on strings and does not require that to be consistent in the code.

Whereas, Black is very specific to expect double quotes on strings across all files unless configured otherwise.

I presume Pycharm's default IDE python formatter will make the minimum changes necessary to fulfill pep8 and the exact behavior is determined by the individual's coding preferences.

Answer from Rob on Stack Overflow
🌐
JetBrains
jetbrains.com › help › pycharm › reformat-and-rearrange-code.html
Reformat and rearrange code | PyCharm Documentation
January 6, 2026 - In the Settings dialog (Ctrl+Alt+S) , go to Editor | Code Style. Switch to the Formatter tab and enable the Turn formatter on/off with markers in code comments option.
Discussions

Practical way to format python code in pycharm?
I'm using CLI tool called "black", it suits my needs very well. Although it's style differs a little bit from PyCharm. More on reddit.com
🌐 r/Python
12
5
September 30, 2018
How to use linters and code formatter in PyCharm IDE with pyproject.toml configuration file
You can run linters as external tools, see here: https://www.jetbrains.com/help/pycharm/configuring-third-party-tools.html#pylint_run I don’t use that tho. I am partial to pre-commit ( https://pre-commit.com/ ) which is a more agnostic solutions and seems to have gained a lot of popularity lately. More on reddit.com
🌐 r/pycharm
2
4
July 22, 2023
intellij idea - How to get the same Python code formatting with PyCharm and Vim? - Stack Overflow
We took a look at formatting tools like Black and YAPF that come with "forced" coding style. However, since this coding style differs from the one in PyCharm, we would need to change the whole codebase, file per file. More on stackoverflow.com
🌐 stackoverflow.com
What are your favorite PyCharm plugins?
W/o IdeaVim i would not use PyCharm. More on reddit.com
🌐 r/Python
95
447
April 12, 2021
🌐
JetBrains
jetbrains.com › help › pycharm › code-style-python.html
Code Style. Python | PyCharm Documentation
April 21, 2026 - In this tab, customize the code style options, which PyCharm will apply on reformatting the source code. The left-hand pane contains the list of exceptions (Keep when reformatting), and placement and alignment options for the various code constructs (lists, statements, operations, annotations, and so on).
🌐
JetBrains
jetbrains.com › help › pycharm › prettier.html
Prettier | PyCharm Documentation
March 9, 2026 - With PyCharm, you can format selected code fragments as well as entire files or directories using the Reformat with Prettier action. PyCharm adds this action as soon as you install Prettier as a dependency in your project or globally on your ...
🌐
JetBrains
jetbrains.com › help › pycharm › command-line-formatter.html
Format files from the command line | PyCharm Documentation
The command-line formatter launches an instance of PyCharm in the background and applies the formatting. It will not work if another instance of PyCharm is already running. In this case, you can perform code style formatting from the running instance.
🌐
JetBrains
jetbrains.com › help › pycharm › reformat-file-dialog.html
Reformat File dialog | PyCharm Documentation
February 27, 2026 - You can define rules and format your code as you write it. To define formatting rules for Python, open the Settings dialog (Ctrl+Alt+S) and navigate to Editor | Code Style | Python.
Find elsewhere
🌐
Read the Docs
black.readthedocs.io › en › stable › integrations › editors.html
Editor integration - Black 26.5.1 documentation
Note that if you are using a virtual environment detected by PyCharm, this is an unneeded step. In this case the path to black is $PyInterpreterDirectory$/black. ... Description: Black is the uncompromising Python code formatter.
🌐
YouTube
youtube.com › pycharm by jetbrains
How to reformat your code in PyCharm - YouTube
In this very short video you will learn how to tell PyCharm to clean up indentation and other code styles in your file. 00:00 - Start 00:13 - Look at 3 PEP s...
Published   May 29, 2020
Views   417
🌐
Medium
akshay-jain.medium.com › pycharm-black-with-formatting-on-auto-save-4797972cf5de
Pycharm + Black with Formatting on Auto-save | by Akshay Jain | Medium
June 11, 2021 - So, lately, I’ve been working with Black for Python code formatting. Pretty cool huh! I’ve seen Black do wonders to my code. It made my (already pretty) code look prettier, I could just gawk at it for hours. But, running black on every file became a tedious task as the size of the project grew. This triggered an urge to find a way to run black as soon as the file is saved. Here, I’m presenting a way to do that with Pycharm ...
🌐
YouTube
youtube.com › watch
How To Format Code In PyCharm? - Next LVL Programming - YouTube
How To Format Code In PyCharm? Are you looking to keep your Python code organized and maintain a consistent style in PyCharm? In this video, we’ll guide you ...
Published   February 26, 2025
🌐
YouTube
youtube.com › watch
How To Format Python Code In PyCharm? - Next LVL Programming - YouTube
How To Format Python Code In PyCharm? Are you looking to improve the appearance and readability of your Python code in PyCharm? In this informative video, we...
Published   March 21, 2025
🌐
Xebia
xebia.com › home › blog › partial python code formatting with black & pycharm
Partial Python Code Formatting With Black & PyCharm | Xebia
January 27, 2026 - This causes me to reformat the code, copy the changed lines I wanted to format, revert formatting, and replace my lines by the copied lines. This felt clumsy and so I went to investigate. First, we need to install Black and configure it in PyCharm. It's available via both Pip and Conda, and runs on Python 3.6 and higher, although it can format older Python code too.
🌐
JetBrains
jetbrains.com › pycharm › guide › tips › reformat-code
Reformat Your Code - JetBrains Guide
March 6, 2023 - You can quickly reformat the whole file by invoking "Reformat Code" ⌘⌥L (macOS) / Ctrl+Alt+L (Windows/Linux).
🌐
Reddit
reddit.com › r/pycharm › how to use linters and code formatter in pycharm ide with pyproject.toml configuration file
r/pycharm on Reddit: How to use linters and code formatter in PyCharm IDE with pyproject.toml configuration file
July 22, 2023 -

I have created a project using cookiecutter-django. In the root of the project, there is a file named pyproject.toml, it has some configs, among these configs there are linters and black (a code formatter) configs.

However, I am unsure how to configure these linters and code formatter in PyCharm using the pyproject.toml file. I'm not sure if I have to create a separate configuration file for each of these tools or if they can work together within the same file.

I'm wondering if there is a way to set up the Pycharm IDE to use these configs so that every time I save a file I get my code linted and formatted.

Could someone share their knowledge or experience in using these tools in PyCharm?

Thank you in advance for any help you can provide!

🌐
Medium
johschmidt42.medium.com › automate-linting-formatting-in-pycharm-with-your-favourite-tools-de03e856ee17
Automate linting & formatting in PyCharm with your favourite tools | by Johannes Schmidt | Medium
June 19, 2023 - Automate linting & formatting in PyCharm with your favourite tools Run black, flake8 & other tools automatically with every file change If you’ve ever worked in a team, you know that to achieve …
🌐
Stack Overflow
stackoverflow.com › questions › 62580212 › how-to-get-the-same-python-code-formatting-with-pycharm-and-vim
intellij idea - How to get the same Python code formatting with PyCharm and Vim? - Stack Overflow
PyCharm has a command line formatter: jetbrains.com/help/pycharm/command-line-formatter.html You can make a shell script and hook it into git to make sure the code is formatted on commit.
🌐
JetBrains
jetbrains.com › help › pycharm › formatting.html
Formatting | PyCharm Documentation
Use this page to configure common formatting options, regardless of the type of a particular file.
🌐
GitHub
github.com › kujason › pep8_formatter
GitHub - kujason/pep8_formatter: Auto PEP8 formatter scripts for PyCharm · GitHub
Auto PEP8 formatter scripts for PyCharm. Contribute to kujason/pep8_formatter development by creating an account on GitHub.
Author   kujason
🌐
JetBrains
jetbrains.com › help › pycharm › settings-code-style.html
Code Style | PyCharm Documentation
February 27, 2025 - In this area, choose the code style scheme and change it as required. Code style scheme settings are automatically applied every time PyCharm generates, refactors, or reformats your code.