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
- Install the official Python extension (VS Code) or enable the Python plugin (PyCharm Community).
- Point the IDE to your project virtual environment.
- Turn on linting (ruff/flake8), formatting (Black), and auto import sorting.
- Configure run/debug profiles for scripts and tests.
VS Code setup
- Install VS Code and the Python extension by Microsoft. Add extensions for Pylance, Black Formatter, and Ruff.
- Open your project folder, then use the Command Palette →
Python: Select Interpreterto choose.venv/bin/python(macOS/Linux) or.venv\Scripts\python.exe(Windows). - Create
.vscode/settings.json:
{
"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`).
- Add run configurations via
Run and Debug→create a launch.json. Include a config for scripts and pytest.
PyCharm Community setup
- Download PyCharm Community (free) or use the Professional version if you need Django/Flask support out of the box.
- When creating a new project, select "Existing environment" and point to your
.venv. - Enable linters: Settings → Tools → External Tools → add
ruffandblackcommands. - Configure
Preferences → Editor → Code Styleto use 4-space indentation and wrap lines at 88 chars.
Boost your toolchain
- Install Git + GitHub CLI for version control.
- Add the Python extension pack for Jupyter support.
- Capture snippets with the CodeSnap extension for docs and sharing.
Testing your setup
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
| Action | VS Code | PyCharm |
|---|---|---|
| Command palette | Ctrl+Shift+P / Cmd+Shift+P | Ctrl+Shift+A |
| Go to definition | F12 | Cmd/Ctrl+B |
| Run selection | Shift+Enter | Shift+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.