Code Editor On Mac For Python

If you have anything to contribute -- e.g. configurations for editors, new editors, or opinion -- don't hesitate to edit or create pages.

Built-in Python syntax highlighting, Python class browsing, Python-compatible regular expressions, code folding, and extensive options for running external tools such as Python scripts. Editra Linux, Windows, Mac OS X. After trying multiple editors and IDE’s in my last 12 years coding with python, I found Vim to be my best buddy. It works everywhere! (not just mac) Trust me today you are coding on Mac and tomorrow you might have to code and run debugger on some.

There's an EditorConfigurationHowto available.

Contents

Please keep wiki links as wiki links, use external links only if there is no existing page for the editor. Please add pages like BoaConstructor also to page IntegratedDevelopmentEnvironments.

Multiplatform Editors

Name

Platform

Impl. Language

License

Notes

Linux, FreeBSD

Python, GTK

GPLv3

Embed Vim. Little brother of PIDA

Unix/X, Windows, Mac OS X

Tcl/Tk

Proprietary

Extensible in Tcl, Tk; Can interact with python.

Unix/X, Windows, Mac OS X

Python

MIT

Python language support for Atom-IDE, powered by the Python language server.

Linux, Windows, Mac OS X

C++, wxWidgets

GPLv3

class browser does not currently work for .py files, but it's still a nice IDE to use for python projects

Linux, Windows, Mac OS X

C, GTK+

GPLv3

The link points to the features page.

Linux, Windows, FreeBSD

C

GPLv3

Cream is a free and easy-to-use configuration of the powerful and famous Vim text editor for both Microsoft Windows and GNU/Linux.

Unix/X, Windows, Mac OS X

C, GTK+

GPLv2

CSS editor with syntax highlighting for Python, and embeded Python interpreter. Extensible through a Python API.

Unix/X, Windows, Mac OS X

Python, wxPython

BSD

Extensible in Python; part of PythonCard. Includes PyCrust shell.

Unix/X, Windows, Mac OS X

Python, PyQt

GPLv3

Complete IDE, very well integrated with PyQT development, but usable for any kind of project. Supports projects, debugging, auto-complete, syntax coloring, etc. It is extensible via plug-in system. It has interfaces to Subversion and Mercurial.

Unix/X, Windows, Mac OS X

Proprietary

BRIEF-compatible, supports Python syntax, in-buffer Python interpreter, supports lots of languages. Powerful macro language.

Windows, Mac OS X, Linux

Tcl/Tk

Public domain

DRAKON diagram editor with code generation in Python.

Windows, Linux and Mac/MacPorts

Python, PyGTK

GPLv3

Interactive shell with history box and code box, auto-completion of attributes and file names, auto-display of function arguments and documentation. Keeps your recent results, provides session history saving (optionally in HTML), interactive plotting with matplotlib. Extremely fast and responsive.

Unix/X, Windows, Mac OS X

Python, wxPython

GPL

Simple, Highly Customizable Editor/Environment. A Tribute to DrScheme.

Unix/X, Windows, Mac OS X

Java

EPL

Eclipse is ... an open extensible IDE for anything and nothing in particular.' Support for Python can be obtained via the PyDEV plugin.

Linux, Windows

Proprietary

Built-in Python syntax highlighting, Python class browsing, Python-compatible regular expressions, code folding, and extensive options for running external tools such as Python scripts.

Linux, Windows, Mac OS X

Python, wxPython

wxWindows

A general purpose developer's text editor written in Python/wxPython. It supports python syntax highlighting, auto-ident, auto-completion, classbrowser, and can run scripts from inside the editor. Extensible with plugins written in python.

Unix/X, Windows, Mac OS

C, Lisp

GPLv3

Python support with EmacsPythonMode. Extensible in Python using pymacs

Linux, Windows, FreeBSD and OS/2

Proprietary

Customizable Python mode, syntax coloring, function tagging.

Linux, Windows, Mac OS

Python, PyQt4

GPLv3

Extensible editor written in Python, Python/C/Nim code tree browser, 3-window editing, text diff, multi-language support, Python REPL, manipulate editor text with Python code

Unix/X, Windows, DOS, OS/2

C++

GPL

Supports lots of languages, including Python; doesn't seem programmable

Unix/X, Windows

C, GTK+

GPLv2

A small and lightweight GTK+ IDE that supports lots of languages, including Python.

Unix/X, Windows, Mac OS

C, Python

GPLv2

gedit is the official text editor of the GNOME desktop environment, with Python syntax highlighting.

Unix/X, Windows, Mac OS

Python, PyQt

Proprietary

Ideas is a feature rich IDE that supports debugging, interpreting and project management.

Linux, Windows, Mac OS X

Java

GPLv2

syntax coloring for python, extensible with jython, supports many file formats, has folding, fully customisable, has sidebar for class and functions, fast for a Java application

Unix, Windows, Mac OS

Java

GPLv3

IDE with Jython Shell. Syntax coloring for python, extensible with jython, supports many file formats, fully customisable, has sidebar for class and functions

Unix, Windows

C

GPLv2

Supports Python syntax and a Python-specific menu.

Unix, VMS, MSDOS, OS/2, BeOS, QNX, and Windows.

C

GPLv2

Syntax highlighting and indenting, (optional) emacs keybindings, programmable with s-lang. Note: comment out 'msw_help(...' line in pymode.sl if you are having problems on Windows.

Unix, Windows, Mac OS

Java

GPLv2

Has three plugins - one for Jython and one for Python/Jython JpyDbg - interactive editing debugging, code browsing, highlighting.

Linux, Windows, Mac OS

Java, Python

GPL

NetbeansjEdit cross IDE plugin

Unix/OSX/Cygwin/Interix (curses), MS-DOS (DR DOS, FreeDOS, Win, OS/2 DOS-Box)

C

GPL

Versatile WordStar-like editor (JOE fork) with many colourised syntax-highlighting modes

Linux, Windows, Mac OS

C++

GPLv2

Kde main developping app. Code folding, syntax highlighting, navigator. projects, class browser, version control, customizable keybindings. Comes also with some typical python project models: pyton Qt app, Tkinter app and simple script.

Unix, Windows, Mac OS X

Proprietary

Komodo is an award winning Python IDE from ActiveState. Fully-integrated Python Python 2.x and Python 3 support featuring code intelligence with autocomplete and calltips, Python debugger (includes remote debugging), interactive shell, remote file support, macros, templating, emacs command support and great help documentation. There is also an open-source version called Komodo Edit (Source), as part of the Open Komodo project started November 2007.

Unix/X, Windows, Mac OS X

Proprietary/Open Source

scaled-down version of Komodo IDE which also supports Python, but excludes the integrated debugger.

Unix/X, Windows, Mac OS X

Python, wxPython

GPLv3

Python IDE with focus is on simplicity and ease of use. It is fast and lightweight. It features Python indentation, line numbers, code folding, syntax highlighting, shell access, code completion, a program runner, a source browser, indentation guides, a white space indicator, autosaving, an edge line, multiple tabs, printing, jumping to a specific line, word searching, word replacement, zooming undo/redo, pastebin.com code submission, Python syntax checking, the ability to change the indentation of many lines at once, autocompletiton, and bad brace checking.

Linux, Windows, Mac OS X

Python, PyQt

MIT

Outlining editor, fully scriptable and extensible, supporting literate programming. 100% pure Python code.

Unix, Windows

C, GTK+

LGPL

Gtk editor with python bindings, allows plugins written in python.

Linux, Windows

C

GNU GPL

Small, terminal-based editor, Syntax highlighting

Unix, Windows, Mac OS X

C

GPLv3

Easy to use, small, powerful, fast, terminal-based editor. Supports UTF-8, syntax highlighting, undo, autocomplete, macros, regexes, bookmarks. v2.4 released 2012-04

Unix/X, Windows, Mac OS X

C

GPLv2

X-Based, Python support builtin.

Unix/X, Windows, Mac OS X, others

Java

GPLv2

Netbeans is an open extensible cross platform IDE ; Support for Python can be obtained via the JpyDbg plugin. A new plugin exists for Netbeans 6.5 or newer - info.

Linux, Windows, Mac OS

Python, PyQt4

GPLv3

Lightweight and extensible editor. Class browser, project manager, PEP8 finder, virtualenv, plugin support

Unix/X, Windows, Mac OS X

Python, wxPython

GPLv2

wxPython based editor. Can be easily extended with mixins and plugins, and has many features. Seems to be biased towards Python web development as contains FTP GUI, RSS aggregator and HTML preview.

Windows NT, Linux (with GTK+ 2)

C++, wxWidgets

Freeware

Easy to use text editor with syntax highlighting for Python. Embeds the Python interpreter to extend functionality of the application

Linux, Windows, Mac OS X

Java

Apache 2.0

Full-featured IDE for Python. Has Free and Open Source edition fully supporting Python as well as proprietary Professional Edition with Django, Flask, Pyramid and Google App Engine support.

Linux, Windows, Mac OS X

Java, Eclipse

EPL

Eclipse plugin. Code-completion. Debugger. Under active development. (ShowMeDo Videos)

Linux, Windows

Python, Tk

GPLv3

Ultra-lightweight Python/text editor made in Python with Tk. Emphasis on easy customization and no-bloat attitude.

Unix, Windows, Mac OS X

Python, wxPython

GPLv2

Written in Python - code folding, snippets, unicode, multiple documents, code completion, several languages, macros.

Linux, Windows, Mac OS X

MIT

Free open-source extension for Visual Studio Code. Supports syntax highlighting, debugging, code completion, code navigation, refactoring, with support for Django, multi threaded, local and remote debugging.

Windows/Linux/Mac (wxPython)

Python

GPLv3

An interactive environment for python features include: Multiple independent python interpreters. Interactively program with different GUI toolkits (wxPython, TkInter, pyGTK, pyQT4 and PySide). Matlab style namespace/workspace browser. Object auto-completions, calltips and multi-line command editing in the console. Object inspection and python path management. Simple code editor and integrated debugger.

Unix/X, Windows, Mac OS X

Python, PySide

BSD License

Open-source Python IDE focused on interactivity and introspection, which makes it very suitable for scientific computing. Its practical design is aimed at simplicity and efficiency. Pyzo consists of two main components, the editor and the shell, and uses a set of pluggable tools to help the programmer in various ways: e.g. source structure, interactive help, workspace, file browser (with functionality for searching). Also includes a post-mortem debugger.

SciTE

Windows, Linux (GTK+)

C++

MIT-Like

A highly configurable light-weight source code editor (about 50 file formats) based on widely-used Scintilla rich text widget/control. Features: sytax highlighting, code folding, auto-indent, brace matching, codepage/unicode support, multiple documents, context help, code execution, output pane, external tools support, RegExp find/replace, text export (HTML, RTF, PDF, LaTeX, XML). Python API for calltips and autocompletion available.

Windows, Linux, Mac OS X

Python, wxPython

GPLv3

Stani's Python Editor. Auto indentation, auto completion, call tips, syntax coloring/highlighting, UML viewer, class explorer, source index, auto todo list, sticky notes, integrated PyCrust shell, Python file browser, recent file browser, drag&drop, context help. Blender support with a Blender 3D object browser, runs interactively inside Blender. Ships with WxGlade (GUI designer), PyChecker (source code doctor) and Kiki (regular expression console). Extensible with WxGlade. (ShowMeDo Videos)

Windows, Linux, macOS

Python, PyQt5

MIT

Spyder is a powerful scientific environment written in Python, for Python,and designed by and for scientists, engineers and data analysts. It features a unique combination of the advanced editing, analysis, debugging and profiling functionality of a comprehensive development tool with the data exploration, interactive execution, deep inspection and beautiful visualization capabilities of a scientific package. Furthermore, Spyder offers built-in integration with many popular scientific packages, including NumPy, SciPy, Pandas, IPython, QtConsole, Matplotlib, SymPy, and more. Beyond its many built-in features, Spyder's abilities can be extended even further via first- and third-party plugins. It is conveniently integrated in the cross-platform Anaconda distribution, and is the centerpiece of the Python(x,y) and WinPython distributions for Windows.

Unix/X, Windows, Mac OS X

Proprietary

Syntax coloring, popup function arguments, class hierarchy browser, graphical debugger, and other nice Python features. Context tagging with class/module namespaces, code navigation, and smart indenting are also supported.

Linux, Windows, Mac OS X

C++, Python

Proprietary

Beautiful interface, Python syntax highlighting, Python plugins.

Linux, Windows, Mac OS X

Python

MIT

For teaching/learning programming. Focused on program runtime visualization. Provides stepping both in statements and expressions, no-hassle variables view, separate mode for explaining references etc.

Unix/X, Windows, Mac OS

C

Charityware

Highly configurable text editor built to enable efficient text editing. Syntax coloring, indenting, autocompletion, and source-navigation tools for Python. Can be scripted in Python. See also Cream.

Unix/X, Windows, Mac OS X

Proprietary

Powerful commercial IDE designed specifically for Python. Auto-completion, call tips, syntax highlighting, goto-definition, keyboard modes for emulating Visual Studio, VI/Vim, Emacs, & Brief, graphical debugger, code browser, integrated shell, scriptable in Python, and much more. (ShowMeDo Videos)

Linux, Windows

Python, wxPython

GPL

Simple text editor written in python. Syntax highlighter, Code fold, Export code in HTML...

Unix-Only Editors

Name

Platform

FreeSoftware?

ZeroPrice?

Notes

Unix + GTK

X

Supports debugging Python, Tcl, Ruby, Perl, Lua scripts. Code intelligence (Code completion, folding, auto-complete, code snippets, syntax highlighting matching tags, show keyword or variable information when mouse over...). Keyword help and improved script document. Integrated commonly-used scripting libraries (Tk, wxPython, Pygame, Pmw, Numeric...). Supports compiling python scripts to Windows EXE files.

Windows-Only Editors

Name

Platform

Impl. Language

License

Notes

Windows

C++

GPL

Notepad++ is a free source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GPL License. Based on the powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size. By optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment.

Windows

Pascal/Delphi

MIT

Free and open-source Python IDE created with the ambition to become competitive in functionality with commercial Windows-based IDEs

Macintosh-Only Editors

Name

Platform

Notes

Mac OS

Python-mode extensible in Tcl

Mac OS X 10.4 or later

Full-featured text editor; includes Python support. TextWrangler is the free version (see below).

Mac OS X 10.7 or later

General purpose editor with autocompletion for the Python standard library, plus inline documentation.

Mac OS X 10.4 or later

'text editor + file transfer + svn + css + terminal + books + more = whoah. welcome to coda. grow beautiful code.'

Mac OS X (Cocoa)

Programmer's text editor with Python syntax highlighting. Written in Python with PyObjC. Open-source (GPL).

OS X (Cocoa)

Fork of Smultron. No longer under development

Mac OS

Included in MacPython distribution.

Mac OS 68k Mac OS 9 Mac OS X

Does not initially include Python support but new language modes can be created. One available here Mi_Python

Mac OS X

Python syntax coloring. Allow multiple author to edit the same file collaborativelly over the network using 'Bonjour' (previously Rendezvous).

Mac OS X 10.4 or later

Free and full-featured text editor based on BBEdit. Includes Python syntax highlighting.

Mac OS X

Free IDE and text editor. Includes Python syntax coloring.

Mac OS X 10.3.9+

Great Cocoa editor with Python support including syntax coloring, integrated documentation, and a runtime wrapper with hyperlinked tracebacks. Note that code-folding of classes is currently broken for PEP 8 compliant code.

Mac OS X 10.6 or later

Again under active development, support for Python syntax coloring. Only available in the Mac App Store.

Mac OS X 10.3 or later

Free OS X based IDE for the Python (and other) programming language (replaces discontinued PyOXIDE), with syntax coloring, completion, tool tips, source level debugger, help browser, etc...

Mac OS X 10.6 or later

Free text editor, with Python syntax highlighting. A paid pro version with more features is also available.

Online Editors

Name

Notes

A general web-based IDE with support for Python. Provides a full Ubuntu environment with Python 2.7.6, and support for Django workspaces.

An interactive Python IDE for data exploration and visualization. Provides a full online Anaconda-based Python environment, with real-time collaboration, interactive IPython sessions, and easy publishing of output figures and code. Includes syntax highlighting and autocomplete. The service was shut down on 2nd Jan 2017

'Host, run, and code Python in the cloud!' Free and paid plans include access to multiple versions of CPython, PyPy, IPython notebooks, a large selection of third-party modules, bash and MySQL shells, and more.

An online IDE for numerical and data science computing experiments - includes: real-time collaboration, a customizable editor, a console and much more. The basic account is free of charge.

A collection of computational mathematics tools in the cloud, including IPython notebooks, SageMath, Numpy/Scipy/Matplotlib, and Cython.

Continuum Analytics' (distributors of the Anaconda Python distribution) hosted data analysis environment. Includes IPython notebooks, data visualization methods like matplotlib and bokeh, ability to add AWS nodes and clusters, command-line shells, file storage, SSH access, and other elements. (Some features require paid account)

Glorified Editors

'IDEs' that don't integrate anything Python-specific go here.

Name

Platform

Notes

Unix + GNOME

Cross-language IDE; syntax coloring & folding for Python.

Linux x86

Commercial IDE with support to 30 other languages.

Unix

Commercial cross-language IDE; nice multi-user project manager.

Windows

Cross-language IDE with integrated SQL support and automation features (currently German only GUI)

Python + wxPython

Simple, Highly Customizable Editor/Environment. A Tribute to DrScheme.

Java + Jython + Python

An OpenSource IDE for Python, Jython, and Java. Supports Syntax highlighting, Code Completion and many more. Developed in Java.

Python + Tkinter + Tix

An extended version of IDLE using Tix.

Java

Java IDE with Python support through Pythonid plugin - includes code completion, syntax & error highlighting, intra-file refactoring

Unix + KDE

Cross-language IDE for KDE - supports Python syntax/projects.

Java

A Java IDE with an optional plugin for Jython.

Windows/X (Python+wxPython)

Written in Python - code folding, snippets, unicode, multiple documents, code completion, several languages, macros.

Windows

Available either as part of ActiveState's ActivePython distribution (which is not open source) or as part of the Win32All extensions from Mark's pages (which is open source).

Unix/Windows/Mac

rope is a python IDE aimed at providing a rich set of software refactorings.

Unix/Windows with Tcl/Tk

Cross-language IDE & Source code analysis tool.

Eclipse

Python and PHP IDE; available in commercial Professional and open-source Foundation versions

Windows

GUI designer for wxPython.

Linux/Windows/Mac

Full featured, free IDE bundled with wxPython, features projects, scintilla, and debugging

Unix/Windows/Mac

Non-free Cross-language GUI dialog designer with integrated support for editing your Python callback functions.

Unix/Windows/Mac

A 'designer' for WxPython (requires wxPython)

Unix/Windows/Mac

Multi-language editor that support python autocomplete, Direcotry/class browser, tags/multi-views editing, unicode, and Django wizard(requires wxPython)

Python Tkinter

GUI, class browser, file manager, with code completion. Licensed under the GPL.

Enhanced Python shells

Name

Platform

Notes

Python + PyCrust

Interactive Python shell included in wxPython.

Python + PySlices

New 'notebook' version of PyCrust with save/load features and the ability to run blocks of code in separate 'slices'.

Unix, Mac OS X, Windows

Enhanced interactive Python shell. Also usable as pythonic system shell (bash/cmd.exe) replacement. Supports autocompletion. Inline syntax highlighting. (ShowMeDo Videos)

Java, at least 1.4

Interactive, embeddable Jython shell with code completion. Licensed under the QPL.

win32

Interactive python shell using wxPython. py script and exe for win. Data plotting capability from within the shell. Free.

KDE

An interactive Python shell using PyKDE and a KHTMLPart (for HTML rendering).

Python 2.3 (or higher) and PyQt

An interactive Python shell using PyQt.

Unix, Mac OS X

Interactive shell with highlighting and autocomplete.

Mobile Device Editors

'IDEs' that run on mobile devices and tablets.

Name

Platform

Notes

iOS

Universal iOS (iPod Touch, iPhone, iPad) IDE.

iOS

Universal iOS (iPod Touch, iPhone, iPad) IDE.

iOS

Universal iOS (iPod Touch, iPhone, iPad) IDE.

iOS

Universal iOS (iPod Touch, iPhone, iPad) IDE.

iOS

Universal iOS (iPod Touch, iPhone, iPad) IDE.

iOS

Universal iOS (iPod Touch, iPhone, iPad) IDE.

iOS

Universal iOS (iPod Touch, iPhone, iPad) IDE.

iOS

Universal iOS (iPod Touch, iPhone, iPad) IDE.

iOS

IDE for iPad

iOS

A Python Interpreter focused on math modules

iOS

IDE for iOS with native graphic and sound support through high-level API; games and interactive demos included

iOS

IDE for iPhone and iPad with Python 3 support. Custom library is supported. See Python Box page for details.

Other Resources

  • Vaults of Parnassus Editor/IDE page.

  • Open Directory Project's Python Tools page.

  • PySmell provides autocompletion for Vim, Emacs and TextMate

Never ending debate

  • EmacsVsVi

CategoryEditorsCategoryEditorsCategoryEditorsCategoryEditorsCategoryEditorsCategoryEditorsCategoryEditorsCategoryEditorsCategoryEditors

Working with Python in Visual Studio Code, using the Microsoft Python extension, is simple, fun, and productive. The extension makes VS Code an excellent IDE, and works on any operating system with a variety of Python interpreters. It leverages all of VS Code's power to provide auto complete and IntelliSense, linting, debugging, and unit testing, along with the ability to easily switch between Python environments, including virtual and conda environments.

This article provides only an overview of the different capabilities of the Python extension for VS Code. For a walkthrough of editing, running, and debugging code, use the button below.

Install Python and the Python extension

The tutorial guides you through installing Python and using the extension. You must install a Python interpreter yourself separately from the extension. For a quick install, use Python 3.7 from python.org and install the extension from the VS Code marketplace.

Once you have a version of Python installed, activate it using the Python: Select Interpreter command. If VS Code doesn't automatically locate the interpreter you're looking for, refer to Environments - Manually specify an interpreter.

You configure the Python extension through settings. See the Settings reference.

Run Python code

To experience Python, create a file (using the File Explorer) named hello.py and paste in the following code (assuming Python 3):

The Python extension then provides shortcuts to run Python code in the currently selected interpreter (Python: Select Interpreter in the Command Palette):

  • In the text editor: right-click anywhere in the editor and select Run Python File in Terminal. If invoked on a selection, only that selection is run.
  • In Explorer: right-click a Python file and select Run Python File in Terminal.

You can also use the Terminal: Create New Integrated Terminal command to create a terminal in which VS Code automatically activates the currently selected interpreter. See Environments below. The Python: Start REPL activates a terminal with the currently selected interpreter and then runs the Python REPL.

Code Editor Mac Python

For a more specific walkthrough on running code, see the tutorial.

Autocomplete and IntelliSense

The Python extension supports code completion and IntelliSense using the currently selected interpreter. IntelliSense is a general term for a number of features, including intelligent code completion (in-context method and variable suggestions) across all your files and for built-in and third-party modules.

IntelliSense quickly shows methods, class members, and documentation as you type, and you can trigger completions at any time with ⌃Space (Windows, Linux Ctrl+Space). You can also hover over identifiers for more information about them.

Tip: Check out the IntelliCode extension for VS Code (preview). IntelliCode provides a set of AI-assisted capabilities for IntelliSense in Python, such as inferring the most relevant auto-completions based on the current code context.

Linting

Linting analyzes your Python code for potential errors, making it easy to navigate to and correct different problems.

The Python extension can apply a number of different linters including Pylint, Pep8, Flake8, mypy, pydocstyle, prospector, and pylama. See Linting.

Debugging

Code Editor On Mac For Python

No more print statement debugging! Set breakpoints, inspect data, and use the debug console as you run your program step by step. Debug a number of different types of Python applications, including multi-threaded, web, and remote applications.

For Python-specific details, including setting up your launch.json configuration and remote debugging, see Debugging. General VS Code debugging information is found in the debugging document. The Django and Flask tutorials also demonstrate debugging in the context of those web apps, including debugging Django page templates.

Snippets

Snippets take productivity to the next level. You can configure your own snippets and use snippets provided by an extension. Snippets appear in the same way as code completion ⌃Space (Windows, Linux Ctrl+Space). For specific examples with Python, see the Django and Flask tutorials.

Environments

The Python extension automatically detects Python interpreters that are installed in standard locations. It also detects conda environments as well as virtual environments in the workspace folder. See Configuring Python environments. You can also use the python.pythonPath setting to point to an interpreter anywhere on your computer.

The current environment is shown on the left side of the VS Code Status Bar:

The Status Bar also indicates if no interpreter is selected:

The selected environment is used for IntelliSense, auto-completions, linting, formatting, and any other language-related feature other than debugging. It is also activated when you use run Python in a terminal.

To change the current interpreter, which includes switching to conda or virtual environments, select the interpreter name on the Status Bar or use the Python: Select Interpreter command.

VS Code prompts you with a list of detected environments as well as any you've added manually to your user settings (see Configuring Python environments).

Installing packages

Packages are installed using the Terminal panel and commands like pip install <package_name> (Windows) and pip3 install <package_name> (macOS/Linux). VS Code installs that package into your project along with its dependencies. Examples are given in the Python tutorial as well as the Django and Flask tutorials.

Jupyter notebooks

Editor

If you open a Jupyter notebook file (.ipynb) in VS Code, the Python extension prompts you to import the notebook as a Python code file. The notebook's cells are delimited in the Python file with #%% comments, and the Python extension shows Run Cell or Run All Cells CodeLens. Selecting either CodeLens starts the Jupyter server and runs the cell(s) in the Python interactive window:

You can also connect to a remote Jupyter server for running the code.

Furthermore, importing a notebook into VS Code allows you to use all of VS Code's debugging capabilities. You can then save the notebook file and open it again as a notebook in Jupyter or upload to a service like Azure Notebooks.

For more information, see Jupyter support.

Unit testing

The Python extension supports unit testing with the unittest, pytest, and nose test frameworks.

Code Editor On Mac For Python Snake

To run unit tests, you enable one of the frameworks in settings. Each framework also has specific settings, such as arguments that identify paths and patterns for test discovery.

Once discovered, VS Code provides a variety of commands (on the Status Bar, the Command Palette, and elsewhere) to run and debug tests, including ability to run individual test files and individual methods.

Configuration

Python Text Editor Download

The Python extension provides a wide variety of settings for its various features. These are described on their relevant topics, such as Editing code, Linting, Debugging, and Testing. The complete list is found in the Settings reference.

Other popular Python extensions

The Microsoft Python extension provides all of the features described previously in this article. Additional Python language support can be added to VS Code by installing other popular Python extensions. For Jupyter support, we recommend the 'Jupyter' extension from Don Jayamanne.

  1. Open the Extensions view (⇧⌘X (Windows, Linux Ctrl+Shift+X)).
  2. Filter the extension list by typing 'python'.

The extensions shown above are dynamically queried. Click on an extension tile above to read the description and reviews to decide which extension is best for you. See more in the Marketplace.

Next steps

  • Python Hello World tutorial - Get started with Python in VS Code.
  • Editing Python - Learn about auto-completion, formatting, and refactoring for Python.
  • Basic Editing - Learn about the powerful VS Code editor.
  • Code Navigation - Move quickly through your source code.

Code Editor On Mac

03/07/2019