- install VS Code
- install the Microsoft Python extension for VS Code (https://marketplace.visualstudio.com/items?itemName=ms-python.python)
- ensure you have a modern install of Python (3.10+)
- pull this code from github
- [Recommended/Optional] create a virtual environment with
python -m venv venv
- install depenencies using
pip install -r requirements.txt
- Open this project up in VS Code and make sure that VS Code is using the version of Python from your virtual environment (use
python select interpreter
in the command pallet)
- Open
main.py
- Place breakpoint on line 3 where requests is called (click to the left of the line and line number). A red dot appears.
- Click the Run and Debug button on the side bar and start debugging.
- You will be asked what you're debugging. Choose to debug a python file.
- VS Code should break into the debugger on line 3.
These steps have already been done in the project.
- Click the Run and Debug button on the side bar
- Choose to create a
launch.json
file - VS Code will create
launch.json
and present it to you - Change
"justMyCode": true
to be"justMyCode": false
- Start debugging as before
Now, VS Code should attempt to step into code in other packages.
One way to do this is to start from YOUR code, and navigate to the place you want to set the breakpoint.
For example...
- Open
main.py
- Right click on the
get
on line 3 and choose "Go to Definition" - This should show you the code for Request's
get
method. Place a breakpoint in here somewhere - Start debugging as before. You may see this breakpoint hit BEFORE line 3 of
main.py
depending upon where you set the breakpoint, and what other code calls this method.
Copyright 2022 Martin Peck