• 6 heures
  • Facile

Ce cours est visible gratuitement en ligne.

course.header.alt.is_video

course.header.alt.is_certifying

J'ai tout compris !

Mis à jour le 01/03/2022

Choose the Right Editor for You

Man working on a laptop

Use a text/code editor

When working on a Python project it is important to have a good local development environment because it allows you to work more efficiently and effectively. One key aspect of this local development environment is your virtual environment. Another key part of your local development environment is your editor, the place where you actually write your source or application code.

A text editor (also known as a code editor, the two terms are used interchangeably) is a program which allows you to write and edit source code, but not too much more than that! Text editors are generally lightweight and run fast.

Some popular examples include Visual Studio Code, Sublime Text, and Atom. Atom, for example, looks like this: 

Atom editor
Atom editor preview
Zoomed in: a sample of the Atom editor

In the screenshot you can see that Atom looks relatively simple. The sidebar on the left shows the project tree and the file view on the right shows the file(s) that you are currently editing.

The functionality of text editors can, however, be extended. Because they are generally open-source (and free!), there are 1,000s of plugins/packages available that make the editor more powerful. Atom, for example, has an ‘Install Packages’ section where you can choose and install packages (note that these are not Python packages - they are just named similarly!): 

Atom packages
Installing packages with Atom
Atom packages
Zoomed in: installing packages with Atom

If you are using a text/code editor for writing source code then you will likely need to also make use of the command line to:

  • Manage activation/deactivation of your virtual environment.

  • Manage installation of packages in your virtual environment.

  • Run your application.

  • Commit changes to your repository with  git .

  • Run tests.

Why use an IDE?

The alternative to using a text/code editor is to use an Integrated Development Environment (IDE). An IDE contains all the functionality of normal text/code editors and much, much more. In the case of Python IDEs, some features that they offer include:

  • A command line terminal where you can run your application. This means that you don’t have to switch programs to run commands in your terminal.

  • A Python interactive shell, which is basically a Python command line that you can use to test short ‘throwaway’ commands that you don’t need to keep a record of. 

  • A Python debugger.

  • Functionality which will automatically save your code and then deploy it to a server/repository of your choice.

  • The ability to run tests inside the IDE.

  • The ability to customize keyboard shortcuts.

  • Much, much more!

Some examples of IDEs are Microsoft Visual Studio and PyCharm. Both Microsoft Visual Studio and PyCharm have paid-for ‘Professional’ editions, but also have free ‘Community’ versions that don’t offer all features/functionality.

To give you an idea for the look and feel of an IDE, let’s consider PyCharm. As with a code/text editor, PyCharm has a traditional project tree view in the sidebar with a view of the file(s) you are editing alongside.

PyCharm editor
A preview of PyCharm
PyCharm editor
Zoomed in: a preview of PyCharm

The command line terminal in PyCharm is also nicely integrated into the view:

PyCharm command line
PyCharm with the Command Line view open
The Command Line view in PyCharm
Zoomed in: the Command Line view in PyCharm

As an alternative to having the terminal open in PyCharm, you can also use the Python interactive shell:

PyCharm Python console
Python interactive shell in PyCharm
Zoomed in: Python console
Zoomed in: Python console

Let’s Recap!

  • Text/code editors are lightweight editors which you can use to write and edit source code. They can be extended/customized to make them more powerful.

  • IDEs are more powerful editors that should allow you to (almost!) do everything you need in your job without leaving the IDE. 

  • There is no ‘right’ or ‘wrong’ editor to choose and use; what matters most is that you become an expert in the editor that you choose.

We’ve taken a look at some of the pros and cons of using text/code editors and IDEs. Next, let’s get you set up on an IDE and see whether you like it! 

Exemple de certificat de réussite
Exemple de certificat de réussite