Debugging Fides in IntelliJ IDEA Ultimate
This guide will show how to use the IntelliJ debugger with Fides running in Docker. The setup for PyCharm Professional should be very similar.
Prerequisites
- Intellij IDEA Ultimate (opens in a new tab) or PyCharm Professional (opens in a new tab)
- Docker plugin (opens in a new tab)
- Python plugin (opens in a new tab) (this is needed for Intellij)
- Docker Desktop (opens in a new tab)
Setup
Connect to Docker daemon
This step will allow the IDE to connect to Docker Desktop.
Go to: Settings/Preferences -> Docker -> +
- Select Docker for "your operating system"
See the screenshot below:
Configure Python Remote Interpreter
Define a Docker-based remote interpreter.
Go to: File -> Project Structure... -> Platform Settings -> SDKs -> +
- Set Server to
Docker
- Set Configuration files to
.docker-compose.yml
- Set Python interpreter path to
python
After clicking OK the Remote Python Docker Compose should be listed as an SDK.
See screenshots below:
Run/Debug Configuration
Set up a Run/Debug Configuration so that breakpoints can be hit in the f sourcecode.
Go to: Run/Debug Configurations -> + -> Python
- To debug Fides, debug the
<path on your machine>/src/fides/main.py
script - Make sure to select Use specified interpreter set the Remote Python Docker Compose (created in the previous section)
- Add
FIDES__CONFIG_PATH=/fides
to Environment variables
See screenshot below:
Hit a Breakpoint
Now the IDE is ready to debug the source code. Click the debug button for main (setup in the previous section).
Try firing a http request to Fides from Postman or Curl and hit a break point.
There is a postman collection in this repo: docs/fides/docs/development/postman/Fides.postman_collection.json
Screenshot of hit breakpoint below:
Links
The information is this guide is largely based on the pycharm (opens in a new tab) and interpeters (opens in a new tab).