If I disabled Prettier as the default formatter, it would not format on save anymore, but my Python would be formatted by autopep8 on save. With this in mind, the following solution worked for me to have both Prettier working for other languages and autopep8 for Python:

{
  "workbench.iconTheme": "vscode-icons",
  "workbench.editorAssociations": [
    {
      "viewType": "jupyter.notebook.ipynb",
      "filenamePattern": "*.ipynb"
    }
  ],
  "git.confirmSync": false,
  "editor.formatOnPaste": true,
  "editor.formatOnSave": true,
  "python.formatting.provider": "autopep8",
  "explorer.confirmDelete": false,
  "python.showStartPage": false,
  "explorer.confirmDragAndDrop": false,
  "python.linting.pylintArgs": ["--load-plugins=pylint_django"],
  "javascript.updateImportsOnFileMove.enabled": "always",
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[python]": {
    "editor.defaultFormatter": "ms-python.python"
  }
}

Let me know if somebody finds a better solution!

Answer from round_circle on Stack Overflow
🌐
Visual Studio Code
code.visualstudio.com › docs › python › formatting
Formatting Python in VS Code
November 3, 2021 - Note: If you don't find your preferred formatter in the table above or in the Marketplace, you can add support for it via an extension. You can use the Python Extension Template to integrate new Python tools into VS Code.
Discussions

formatting - Why is VSCode's Prettier Extension not working for Python? - Stack Overflow
Prettier won't format my python files. Help me what to do! help me with this. I am using prettier and tried it. It worked well with javascript. More on stackoverflow.com
🌐 stackoverflow.com
Python Formatting using black conflicting with prettier
Issue Type: Bug VS Code version: Code 1.61.2 (6cba118, 2021-10-19T14:57:20.575Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No Remote OS version: Linux x64 5.10.16.3-microsoft-standard-... More on github.com
🌐 github.com
2
July 20, 2021
A better Python formatter?
The formatting that comes with the Python extension does the job most of the time, but i was wondering if any of you are aware of a way to have a more comprehensive formatter, kind of like Prettier, but for Python. More on reddit.com
🌐 r/vscode
7
7
September 23, 2022
Extension 'prettier - Code formatter' cannot format "hello.py"
Summary I used to write javascript only in vs code and everything works fine. But now I start learning python. When I hit ctrl-s will see this warning: Extension 'prettier - Code formatter' cannot ... More on github.com
🌐 github.com
4
May 23, 2020
🌐
DEV Community
dev.to › eegli › quick-guide-to-python-formatting-in-vs-code-2040
Quick Guide to Python Formatting in VS Code (2025) - DEV Community
February 1, 2025 - I prefer applying this configuration to my user settings - this way, I can easily start a Python project and will get formatting out of the box based on my user settings. No need to create dedicated workspace settings for every single project and override the formatter over and over. Here's the relevant config from my settings: { "editor.defaultFormatter": "esbenp.prettier-vscode", "[python]": { "editor.defaultFormatter": null }, "python.formatting.blackArgs": ["--line-length", "120"], "python.formatting.provider": "black", }
🌐
GitHub
github.com › prettier › prettier-vscode
GitHub - prettier/prettier-vscode: Visual Studio Code extension for Prettier · GitHub
Visual Studio Code extension for Prettier. Contribute to prettier/prettier-vscode development by creating an account on GitHub.
Starred by 5.5K users
Forked by 510 users
Languages   TypeScript 78.4% | JavaScript 20.2% | PHP 0.6% | Dockerfile 0.3% | HTML 0.3% | SCSS 0.1%
🌐
Prettier
prettier.io
Prettier · Opinionated Code Formatter · Prettier
Elm (via elm-format) Java · PHP · Ruby · Rust · TOML · XML · And more... prettier-js prettier.el Apheleia · espresso-prettier · Prettier Prettier⁺ · JsPrettier · vim-prettier neoformat ALE coc-prettier · JavaScriptPrettier · prettier-vscode · Built-in support ·
🌐
Hostman
hostman.com › tutorials › how to format code with prettier in visual studio code
How to Format Code Using Prettier in Visual Studio Code
October 20, 2025 - This utility automatically formats Python code according to PEP 8, the official Python style guide, using pycodestyle to identify areas needing formatting. Autopep8 can fix most issues flagged by pycodestyle. To avoid the need for manual formatting each time, enable auto-formatting on save in Prettier:
Price   $
Address   1999 Harrison St 1800 9079, 94612, Oakland
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-format-code-with-prettier-in-visual-studio-code
Format Code with Prettier in Visual Studio Code: Setup Guide | DigitalOcean
August 1, 2025 - Prettier Can Be Run Manually or ... always formatted cleanly with minimal effort. You Can Customize Prettier to Match Your Preferences: Settings such as quote style, semicolon usage, tab width, and more can be adjusted in the VS Code UI or through a .prettierrc configuration file. Team Projects Benefit from Shared Configuration: Using .prettierrc, .prettierignore, and workspace-level .vscode/settings.json ...
🌐
YouTube
youtube.com › watch
How to Format Python Code on Save in Visual Studio Code | Auto-Format Python in VS Code - YouTube
🚀 **Automatically Format Python Code on Save in VS Code!** Tired of fixing code formatting manually? In this quick and easy tutorial, I’ll show you how to ...
Published   February 22, 2025
🌐
JustAnswer
justanswer.com › computer › rd8ph-want-set-extension-prettier-vs-code-save.html
How to Set Prettier as VS Code Save Formatter?
I have ESLInt and Prettier, but on JSX it's not seem to be working however for Scss it's working fine ... Can someone help me with debugging Python in VS Code.
🌐
GitHub
github.com › microsoft › vscode › issues › 136179
Python Formatting using black conflicting with prettier · Issue #136179 · microsoft/vscode
July 20, 2021 - I setup black as my default python formatter "python.formatting.provider": "black" My default formatter is prettier "editor.defaultFormatter": "esbenp.prettier-vscode" Also I have "editor.formatOnSave": true · But black is only working when I am commenting out "editor.defaultFormatter": "esbenp.prettier-vscode" from settings.json ·
Author   KunalTanwar11
🌐
Reddit
reddit.com › r › vscode › comments › 95lsb8 › a_better_python_formatter
r/vscode on Reddit: A better Python formatter?
September 23, 2022 - Seems like it's what i'm looking for. Needs Python 3 though, but i'll figure it out ... Python 3 is the go to right now...I really don't see any point using 2, only if it's an old project or something. ... It's an old project. I'd have to figure out how to use Python2 for development and Python 3 to install and run packages.
🌐
GitHub
github.com › prettier › plugin-python
GitHub - prettier/plugin-python: Prettier Python Plugin · GitHub
October 1, 2019 - Check out yarn prettier -- --help for other options. yarn add --dev --exact prettier @prettier/plugin-python
Starred by 520 users
Forked by 38 users
Languages   JavaScript 72.2% | Python 27.8%
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 1395
Extension 'prettier - Code formatter' cannot format "hello.py" · Issue #1395 · prettier/prettier-vscode
May 23, 2020 - Summary I used to write javascript only in vs code and everything works fine. But now I start learning python. When I hit ctrl-s will see this warning: Extension 'prettier - Code formatter' cannot format "hello.py" Github Repository to R...
Published   May 24, 2020
Author   krave1986
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 2307
Prettier not respecting indentation settings for python (tabs) · Issue #2307 · prettier/prettier-vscode
November 28, 2021 - Prettier screws up all of the indenting in all of my files and always uses 4 spaces. I've selected tabs and indent size 4 on the bottom, set indent style and size in editor config, set the formatter for python to be prettier as well as use tabs and tab width in settings.json, and created a prettierrc with tab width and use tabs.
Author   justingolden21
🌐
Medium
medium.com › @glen.gracieux › auto-formatting-on-vs-code-using-prettier-extension-743b88f1539d
Auto formatting on VS Code using Prettier extension. - Glen Paulson - Medium
August 26, 2023 - Auto formatting on VS Code using Prettier extension. Steps to enable Prettier code formatter extension on VS Code Step 1 → Open VS Code → Navigate to Extensions → Search for Prettier → …
🌐
freeCodeCamp
freecodecamp.org › news › how-to-use-prettier-in-visual-studio-code
How To Use Prettier in Visual Studio Code
March 18, 2024 - When your Prettier extension is installed, you need to configure Visual Studio Code to take advantage of it. You can do in the Settings tab. Side node: to open the Settings tab, you can use COMMAND + , on macOS or CTRL + , on Windows and Linux: ... At the top of the Settings tab you will find a search box. Now, you need to type formatter, and then Editor: Default Formatter will pop up on the settings list:
🌐
Donjayamanne
donjayamanne.github.io › pythonVSCodeDocs › docs › formatting
Formatting | Python in Visual Studio Code
If this cannot be found, then the formatter will be resolved based on the current environment Path settings. If this is not the case or you wish to use another version of autopep8, all you need to do is configure the path as follows either in the User or Workspace settings file: "python.formatting.autopep8Path": "c:/path/autopep8.exe"
🌐
Orchestra
getorchestra.io › guides › how-to-install-black-formatter-on-vs-code
How to Install Black Formatter on VS Code | Orchestra
February 10, 2026 - Learn how to install and configure Black Formatter on VS Code to streamline Python code formatting and ensure consistent code style.