Integrated Development Environment

An Integrated Development Environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools and a debugger.

Python’s specific IDE

There are many IDEs for Python, but none are perfect, and there is no consensus in the Python community. There is no real “canonical” choice as Rstudio is the one for R users.

As Python is a real jackknife programming language, depending on your goal (data scientific program, web development, etc.) you may choose a specific IDE for a particular task.

We warmly recommend you use an IDE, and we will mostly describe VSCode in what follows.

VSCode/Codium

For instance, you can use VSCode. This is a powerful, cross-platform IDE that comes with many extensions.

On the FdS-Linux box, there is a fork of VSCode called vscodium. You may launch it via the GUI or through the following command line

$ vscodium

or

$ code

Install a VSCode extension

We will install the Python extension. To install it:

  1. Open VSCode.
  2. Open the Extensions tab (left bar of the VSCode window or simply press Ctrl+Shift+X)
  3. Type Python to find the Python extension from Microsoft
  4. Click the Install button, then the Enable button

or

  1. Open VSCode
  2. Press Ctrl+P to open the Quick Open dialog
  3. Type ext install ms-python.python to find the extension
  4. Click the Install button, then the Enable button

or

  1. Run in a terminal
$ vscodium --install-extension ms-python.python
EXERCISE: Installation on your machine
  1. Install the Python extension in your VSCode

An advanced text editor

The keyboard shortcuts Reference guide is available in the help menu (or with Ctrl+K Ctrl+R shortcut). It can be very useful to learn some shortcuts. For instance:

  • Learn how multicursors work (e.g., search for an occurrence with Ctrl+d)
  • Create aligned multicursors with Ctrl+Shift
  • Learn how to move an entire line with Alt+up
  • etc.

Using VSCode as a Python IDE

Reference: VSCode docs for Python

This part is dedicated to setting up VSCode to use it as a Python IDE. You should have a working VSCode (with Python extension) and anaconda program.

EXERCISE: VSCode and Python
  1. Start VSCode in a project (workspace) folder: Using a command prompt or terminal, create an empty folder called test_dir, navigate into it, and open VSCode (vscodium) in that folder (.) by entering the following commands:

    cd ~
    mkdir test_dir
    cd hello
    code

    Note: If you’re using an Anaconda distribution, be sure to use an Anaconda command prompt.

    By starting VSCode in a folder, that folder becomes your “workspace”. VSCode stores settings that are specific to that workspace in the (hidden) subfolder .vscode/settings.json, which are separate from user settings that are stored globally.

    Alternatively, you can run VSCode through the operating system UI, then use File > Open Folder to open the project folder.

  2. Select a Python interpreter: Python is an interpreted language; to run Python code, you must tell VSCode which interpreter to use.

    From within VSCode, select a Python 3 interpreter by opening the Command Palette (Ctrl+Shift+P), start typing the Python: Select Interpreter command to search, then select the command. You can also use the Select Python Environment option on the Status Bar if available

  3. Open the terminal in VSCode and download with wget or curl the file test_python.py here. Run it through the IDE.

  4. Next, you have to learn how to debug a simple Python script, see the VSCode help on debugging for that.

Back to top