Skip to main content

Configure Your Python IDE (VS Code & PyCharm)

Launch Sprint · Day 3

Dial in your Python IDE

Invest 15 minutes to configure VS Code or PyCharm with type checking, formatting, and virtual environments so every new tutorial feels effortless.

VS Code · PyCharm

Editors covered

+30% productivity

Boost

~15 mins

Time

TL;DR checklist

  1. Install the official Python extension (VS Code) or enable the Python plugin (PyCharm Community).
  2. Point the IDE to your project virtual environment.
  3. Turn on linting (ruff/flake8), formatting (Black), and auto import sorting.
  4. Configure run/debug profiles for scripts and tests.

VS Code setup

  1. Install VS Code and the Python extension by Microsoft. Add extensions for Pylance, Black Formatter, and Ruff.
  2. Open your project folder, then use the Command Palette → Python: Select Interpreter to choose .venv/bin/python (macOS/Linux) or .venv\Scripts\python.exe (Windows).
  3. Create .vscode/settings.json:
VS Code settingsBEGINNER
{
"python.pythonPath": ".venv/bin/python",
"python.analysis.typeCheckingMode": "basic",
"python.formatting.provider": "black",
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"ruff.organizeImports": true,
"terminal.integrated.env.linux": {
"PYTHONWARNINGS": "ignore"
}
}

Adjust path for Windows (`.venv\\\\Scripts\\\\python.exe`).

  1. Add run configurations via Run and Debugcreate a launch.json. Include a config for scripts and pytest.

PyCharm Community setup

  1. Download PyCharm Community (free) or use the Professional version if you need Django/Flask support out of the box.
  2. When creating a new project, select "Existing environment" and point to your .venv.
  3. Enable linters: Settings → Tools → External Tools → add ruff and black commands.
  4. Configure Preferences → Editor → Code Style to use 4-space indentation and wrap lines at 88 chars.

Boost your toolchain

Testing your setup

Smoke test your IDEBEGINNER
def greet(name: str) -> str:
return f"Hello {name}"


def test_greet():
assert greet("Python") == "Hello Python"


if __name__ == "__main__":
print(greet("World"))

Run the script directly and via the debugger. Execute tests with pytest or the built-in test runner.

Keyboard accelerators

ActionVS CodePyCharm
Command paletteCtrl+Shift+P / Cmd+Shift+PCtrl+Shift+A
Go to definitionF12Cmd/Ctrl+B
Run selectionShift+EnterShift+Cmd/Ctrl+Enter

Next up in your learning path

Frequently Asked Questions

Do I need both VS Code and PyCharm?

No. Pick the editor that matches your workflow. VS Code is lightweight and extensible; PyCharm is batteries-included with Python intelligence.

Which formatter/linter combo should I use?

Black + Ruff is fast and aligns with modern Python style guides. You can also use autopep8 + flake8 if your team prefers.

How do I sync settings across machines?

VS Code has built-in Settings Sync. PyCharm can sync via JetBrains account or by exporting settings jars.