Skip to content

VOL 00 / CH 04 / LESSON 01

4.1 Preparing a Debuggable Development Environment ​

Prerequisites: Chapter 3 (Git and Version Control)

Estimated time: 10 minutes

Exercise environment: Python 3 and an IDE that supports Python debugging; the interface name may vary with version

You are ready to continue when: the IDE uses the correct project root directory, interpreter, and debug configuration

A debugger must stop in the code you are reading before it can explain an unexpected variable. Use a one-line program to check the entry point, interpreter, and working directory before debugging application logic. A breakpoint that never triggers usually points to a mismatch in the directory, entry point, interpreter, or source version, not a broken IDE.

Choosing Tools Based on Project Constraints ​

VS Code is an extensible editor whose debugging capabilities are provided by language extensions and debug adapters; IntelliJ IDEA excels in JVM project capabilities, with support for other languages depending on the version and plugins. Existing team configurations, target languages, remote environments, and licenses are more important than "which IDE is the best."

The interface will update, and this page does not fix the position of plugin buttons. Installation sources should be the official marketplace of the IDE or approved channels by the organization, and the publisher, permissions, and maintenance status should be checked.

Creating an Isolated Project ​

bash
python3 --version
workdir=$(mktemp -d)
mkdir -p "$workdir/debug-workshop"
cd "$workdir/debug-workshop"
printf '%s\n' 'print("hello workshop")' > hello_workshop.py
python3 hello_workshop.py

Open the debug-workshop directory with your IDE, rather than a single file alone. Verify:

  1. The status bar or project settings are using the expected Python interpreter.
  2. The python3 in the integrated terminal matches the debugger configuration's environment, or you are explicitly aware of why they might differ.
  3. The run entry point is hello_workshop.py, and the working directory is the project root directory.
  4. A normal run produces stable output, and then switch to debug mode.

The Python debugger in VS Code is provided by the Microsoft Python and Python Debugger extension; in IntelliJ/PyCharm, Python capabilities depend on the product and plugins. For Java projects, verify the project SDK, module, and build tools imports. Even before installation, check the publisher of the extension, rather than the similar name alone.

First Breakpoint ​

Click the gutter beside the print line to set a breakpoint, then launch the current file in Debug mode. If the breakpoint is not bound, check the target being run, interpreter, and source mapping before modifying business code.

Cleanup exercise:

bash
cd
ls -ld -- "$workdir"
rm -r -- "$workdir"

When interface steps change, refer to the Python Debugging Documentation for VS Code or the official manual of your current IDE.

→ Next: Breakpoints, Variables, and Step-by-Step

Built with VitePress | Software Systems Atlas