The aim of this page π is to explain how to use IPython as the default Python REPL (watch Sebastian Witowski's talk if not convinced) and configure VS Code to execute code in IPython, as I am slowly switching to iPython for my default REPL. A big part of this is to be able to execute selections of code with shift+enter
in VS Code, and then quickly toggle between ipython for exploration, and vscode for code editting. I was toying with an idea to create a pure-vim workflow, but the combination of VS Code + iPython set up this fast is too tempting.
- Configure VS Code to use IPython with Shift+Enter: Open settings (
Ctrl+,
orCmd+,
), and add/update insettings.json
:
python.terminal.launchArgs": [ "-m", "IPython", "--no-autoindent", ],
- Example issue when running IPython:
/opt/homebrew/opt/python@3.13/bin/python3.13: No module named ipython
- Resolve by installing IPython in correct environment:
python -m pip install ipython
- I am using
shift+alt+p
for quick toggling between iPython in a terminal panel and VS Code proper. This is the keyboard shortcut config
{ "key": "shift+alt+p", "command": "workbench.action.focusPanel", "when": "!panelFocus" }, { "key": "shift+alt+p", "command": "workbench.action.focusActiveEditorGroup", "when": "panelFocus" }
Top comments (0)