Tools to develop Python code
Introduction¶
We’ve seen that Python is dynamically typed and interpreted. These properties make it very flexible and beginner-friendly, but they also mean that many errors that a compiled language would catch at compile time will only surface at runtime in Python. This makes tooling and testing essential.
Developer tools and good practices¶
The main categories of tools a Python developer relies on are:
Linters and formatters: analyze your code for errors and style issues, and automatically reformat it to a consistent style (see PEP 8). Ruff has become the standard tool for both tasks in the Python ecosystem.
Type checkers: optionally verify type consistency without running the code
Tests: catch regressions and document expected behavior
Documentation: make code usable by others (and by yourself in six months)
We will come back to each of these in later sections. This page focuses on the first line of defense: your editor.
Virtual environments¶
Python packages can be installed globally, but it quickly leads to conflicts between projects requiring different versions of the same library. Virtual environments solve this by giving each project its own isolated set of installed packages.
You have already set up and activated the virtual environment for this training with
pdm sync. Make sure it is always activated when working on the exercises — if you open
a new terminal, you will need to activate it again.
A good editor will show you which environment is currently active and let you switch between them easily. In VSCode, the active interpreter is shown in the status bar at the bottom of the window — check that it points to the training’s virtual environment.
Editors¶
A good editor is not just a place to type text — it actively helps you write correct code. Key features to look for:
Syntax coloring: makes code structure immediately readable
Automatic indentation: critical in Python where indentation defines blocks
Linting and formatting: flags errors and style violations as you type, and automatically rewrites your code to conform to PEP 8
Code completion and introspection: suggests completions, shows signatures, lets you jump to definitions
Among open-source editors suitable for Python:
VSCode / VSCodium — versatile, well-maintained, excellent Python support via extensions; our recommended choice for this training
Spyder — designed specifically for scientific Python (see below)
JupyterLab — ideal for notebook-style exploratory work (already seen)
Emacs / Vim — powerful historical editors, but require significant configuration to be productive; worth learning eventually, not as a first editor
PyCharm is a popular proprietary alternative with strong Python-specific features (a free community edition exists).
Most editors support syncing your configuration across machines (via a settings sync feature or a dotfiles repository), which is worth setting up early.
A note on Spyder¶
Spyder is an IDE designed specifically for scientific Python. It will feel familiar to users coming from Matlab: it has a variable explorer, an integrated IPython console, and a layout that encourages interactive, exploratory work. It is a perfectly valid choice for scientific computing workflows and is used by many researchers.
In this training we focus on VSCode and JupyterLab, which cover the widest range of use cases and are good choices for most participants. If you already know Spyder well, feel free to use it for the exercises — but we won’t have time to cover it, so you will need to find the equivalent features on your own.
Where and how to find help¶
No developer works in isolation. Knowing where to look for help is a skill in itself.
Search engines and Stack Overflow (https://
stackoverflow .com): most common errors have already been asked and answered; learn to search precisely (include the error message, the library name, the Python version) Official documentation: Python’s own docs (https://
docs .python .org) are excellent and should be your first stop for standard library questions Mailing lists and forums:
python@services.cnrs.frfor the CNRS community, https://discuss .python .org for broader discussions Generative AI: useful for boilerplate, explanations, and debugging hints — but requires critical judgment; we cover this in a dedicated section