The Best Python Code Editors for Data Science, Web Development, and Machine Learning

Choosing an integrated development environment (IDE) that suits your needs is often a non-trivial task. There are many available options. There is a number of interesting IDEs, with all kind of tools that might help you code faster and avoid some errors. Some of them are free and open-source.

Most well-known IDEs have support for Python, one of the most popular programming languages. They usually support linting, auto-completion, and choosing a Python environment for each project.

This article describes several widely-used Python IDEs, suitable for data science, machine learning, web development, and so on. We’ll cover:

  • Visual Studio Code
  • Atom
  • Sublime Text 3
  • Spyder
  • PyCharm
  • Visual Studio

Visual Studio Code

Visual Studio Code (or VS Code) is a free, open-source, and general-purpose IDE, or to be more precise — code editor. It’s lightweight and reasonably fast. Don’t mix it up with its older and bigger brother — Visual Studio. The main characteristics of the VS Code are:

  • VS Code was created by Microsoft in 2015.
  • VS Code is available for Linux, Windows, and Mac OS.
  • VS Code is a general-purpose IDE that supports Python, C/C++, C#, JavaScript, HTML, CSS, Markdown with previews, and many more languages.
  • VS Code is mature and has a wide and dedicated community.
  • VS Code has integrated terminal, source-control and debugging support.
  • VS Code is free and open-source, even for commercial purposes. It’s licensed under the MIT license.

If you want to use Python in VS Code, you’ll probably need to install Microsoft’s Python extension. It’s simply called Python. Go to File/Preferences/Extensions (or click on the square icon on the top left or just click Ctrl+Shift+X). Type python and you’ll get the extensions available for installation.

Microsoft’s Python extension provides linting, auto-completion, and working with interactive Python. It can even handle and preview the .ipynb files.

Of course, you might want to install other extensions related to Markdown, web development, or C/C++, etc.

If you click File/Preferences/Settings (or just Ctrl+Comma), you’ll be able to adjust settings for the environment in general, as well as for Python. You can customize the settings for a particular project by adding the folder .vscode with the file settings.json in the project folder.

Atom

Atom is another free, open-source, and general-purpose IDE, i.e. code editor. It’s similar to the Visual Studio Code. Some of its most important characteristics are:

  • Atom was created by GitHub in 2014.
  • Atom is available for Linux, Windows, and Mac OS.
  • Atom is suitable for programming in Python, C/C++, JavaScript, and many more languages. You can also use it for HTML, CSS, Markdown with previews, and more.
  • Atom is mature and has a wide and dedicated community.
  • Atom has integrated GIT and GitHub support.
  • Atom is free and open-source, even for commercial purposes. It’s licensed under the MIT license.

The dedicated community has developed many extensions for Atom that might make coding a real joy. You’re not going to make it far with Atom without extensions.

If you want to code in Python, go to Edit/Preferences (or press Ctrl+Comma) and choose Packages. You’ll see that some packages are already installed by default. You might want to install the packages like simple-drag-drop-text, highlight-selected, linter, linter-python-pep8, linter-flake8, linter-pylint, autocomplete-python, hydrogen, python-tools, ide-python, platformio-ide-terminal, etc.

For the packages for linting, as well as for ide-python, you’ll need to click settings and set Python executable paths. For the package python-tools, you should set the path to the Python directory.

Unlike VS Code, Atom doesn’t come with an integrated terminal. However, the package platformio-ide-terminal will provide you a nice experience of working in a terminal, especially useful if you use Windows and a native Console is a poor option.

One of the most loved Atom features among data scientists is Hydrogen. If you install the package hydrogen, you’ll get the best available experience of working with interactive Python inside the .py files.

The main downside of Atom is the fact that it’s slow, especially when it starts. At the moment it’s noticeably slower than VS Code.

Sublime Text 3

Sublime Text 3 is another Python IDE/code editor somewhat similar to VS Code and Atom. But it’s faster. Much faster! It’s created by Jon Skinner in 2008. It’s interesting that it has the Python application programming interface (API).

Similarly to VS Code and Atom, Sublime Text 3 is a general-purpose editor that supports many languages. It can be used on Linux, Windows, and Mac OS. It has a dedicated community with a number of extensions available that enable you to do scientific computing, data science, web development, and more.

Unfortunately, Sublime Text 3 is not open-source. It’s proprietary software that costs 80 USD. You can use it without limitations in the evaluation mode — with all features, but also with occasional notifications about the purchase. Once you buy it, you have it for all your devices.

The other downside of Sublime Text 3 is the fact that it’s much harder for setup. We’re not going to explain that here. But there are many articles, blog posts, and videos covering this.

Spyder

Spyder (short for the Scientific Python Development Environment) is another free and open-source Python IDE. Its main characteristics are:

  • Spyder was created by Pierre Raybaut in 2009.
  • Spyder is available for Linux, Windows, and Mac OS.
  • Spyder is distributed with Anaconda. So, when you install Anaconda, you have Spyder as well.
  • Spyder is suitable for scientific programming in Python, as well as for data science and machine learning. In fact, it’s one of the best tools for this purpose. It’s not a good choice for web development.
  • Spyder is mature.
  • Spyder has integrated IPython console, profiler, debugger, documentation viewer, variable explorer, and more.
  • Spyder is fully written in Python.
  • Spyder is free and open-source, even for commercial purposes. It’s licensed under the MIT license.

The main advantages of Spyder over the other Python IDEs are:

  • IPython console that makes testing small code parts really comfortable
  • By far the best in class variable explorer in the Python world
  • A comfortable documentation viewer

PyCharm

PyCharm is a full-featured Python IDE created by JetBrains in 2009. It’s cross-platform with Linux, Windows, and Mac OS support. It provides coding assistance, refactoring, integrated debugger, linters, support for web development, Python console, IPython, excellent support for Anaconda and scientific packages, and more.

PyCharm is proprietary software. It’s not free.

Visual Studio

Visual Studio (or just VS) is another proprietary full-featured IDE. It was created by Microsoft in 1997. VS is a heavy-weight IDE with support for many languages. It offers intellisense, code refactoring, debugging, profiling, and other tools. It has full support for Python, including scientific computing, data science, and web development.

VS has Python console and excellent support for web projects in Django, Flask, Bottle, etc. VS really excels in so-called mixed-mode debugging, that is when you need to debug Python and C/C++ side by side.

For most Python developers VS is unnecessarily heavy. It can be used on Windows and Mac OS but lacks Linux support.

There are three versions of VS: Community Edition (free, but limited on small teams, open-source projects, etc.), Professional Edition (not free), and Enterprise Edition (also not free).

Conclusions

These are just some of Python IDEs available on the market at the moment. This article didn’t cover Vim, Emacs, Geany, Eclipse, Kdevelop, Thonny, and more.

This article also didn’t cover a fantastic piece of software — Jupyter. It’s not a classical Python IDE. It doesn’t even work with .py files. But it’s very useful, popular and definitively worth exploring, especially for people interested in scientific computing, data science, and machine learning.

If you’re a Python beginner, you probably should be fine with VS Code or Atom, especially for web development. They are free, easy to install, set, and use. If you’re into scientific computing, data science, machine learning, or a similar field, VS Code and Atom (with Hydrogen) are good as well. But you should also check Spyder and Jupyter.

Thank you for reading!