DEV Community

Pavol Z. Kutaj
Pavol Z. Kutaj

Posted on

How to use iPython in VS Code

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+, or Cmd+,), and add/update in settings.json:
python.terminal.launchArgs": [
    "-m",
    "IPython",
    "--no-autoindent",
],
Enter fullscreen mode Exit fullscreen mode
  • Example issue when running IPython:
  /opt/homebrew/opt/python@3.13/bin/python3.13: No module named ipython
Enter fullscreen mode Exit fullscreen mode
  • Resolve by installing IPython in correct environment:
  python -m pip install ipython
Enter fullscreen mode Exit fullscreen mode
  • 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"
    }
Enter fullscreen mode Exit fullscreen mode

LINKS

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay