|
| 1 | +# Configuring the Debugger |
| 2 | + |
| 3 | +## For VSCode |
| 4 | + |
| 5 | +### Set Up the debugger configuration (one-time setup step) |
| 6 | +To configure the debugger in VSCode to run the `debug_manifest`, follow these steps: |
| 7 | + |
| 8 | +1. Clone or Open the existing `airbyte-python-cdk` project in VSCode. |
| 9 | +2. Click on the Run and Debug icon in the Activity Bar on the side of the window. |
| 10 | +3. Click on the `create a launch.json file` link to create a new configuration file. |
| 11 | +4. Select `Python` from the list of environments. |
| 12 | +5. Replace the contents of the generated `launch.json` file with the following configuration: |
| 13 | + |
| 14 | +```json |
| 15 | +{ |
| 16 | + "version": "0.2.0", |
| 17 | + "configurations": [ |
| 18 | + { |
| 19 | + "name": "Python: Debug Manifest", |
| 20 | + "type": "debugpy", |
| 21 | + "request": "launch", |
| 22 | + "console": "integratedTerminal", |
| 23 | + "cwd": "${workspaceFolder}/debug_manifest", |
| 24 | + "python": "<PATH_TO_CDK_ENV>/bin/python", |
| 25 | + "module": "debug_manifest", |
| 26 | + "args": [ |
| 27 | + // SPECIFY THE COMMAND: [spec, check, discover, read] |
| 28 | + "read", |
| 29 | + // SPECIFY THE CONFIG |
| 30 | + "--config", |
| 31 | + // PATH TO THE CONFIG FILE |
| 32 | + "resources/config.json", |
| 33 | + // SPECIFY THE CATALOG |
| 34 | + "--catalog", |
| 35 | + // PATH TO THE CATALOG FILE |
| 36 | + "resources/catalog.json", |
| 37 | + // SPECIFY THE STATE (optional) |
| 38 | + // "--state", |
| 39 | + // PATH TO THE STATE FILE |
| 40 | + // "resources/state.json", |
| 41 | + // ADDITIONAL FLAGS, like `--debug` (optional) |
| 42 | + "--debug" |
| 43 | + ], |
| 44 | + } |
| 45 | + ] |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +6. Save the `launch.json` file. |
| 50 | +7. Install `CDK dependencies` by running `poetry install --all-extras` |
| 51 | +8. Replace the `"python": "<PATH_TO_CDK_ENV>/bin/python"` with the correct interpreter `PATH` pointing to the `CDK env` installed from Step `7` (use `which python` to have the complete python path), to wire the CDK env to the debugger. Alternatively you can switch the default interpreter you use in your IDE. |
| 52 | +### Set up the necessary resources to use within the manifest-only connector |
| 53 | +* These resources are ignored by `git`, in the `.gitignore`, thus should not be committed |
| 54 | +1. Put the `config.json` inside the `/airbyte_cdk/debug_manifest/resources` (this will hold the `source input configuration`). |
| 55 | +2. Put the `catalog.json` inside the `/airbyte_cdk/debug_manifest/resources` (this will hold the `configured catalog` for the target source). |
| 56 | +3. Put the `manifest.yaml` inside the `/airbyte_cdk/debug_manifest/resources` |
| 57 | +4. (Optional) Put the `state.json` inside the `/airbyte_cdk/debug_manifest/resources` |
| 58 | + |
| 59 | +## Debugging Steps |
| 60 | +1. Set any necessary breakpoints in your code, or `CDK` components code. |
| 61 | +2. Press `F5` / `Shift + CMD + D` / click the green play button in the `Run and Debug` view to start debugging. |
| 62 | +3. Iterate over the `2` and `3`, to debug your `manifest-only` source. |
| 63 | + |
| 64 | +Basically, you're now able to run the `manifest-only` sources like the regular python source, with `spec`, `check`, `discover` and `read` commands, as well as having the `--debug` alongside. |
0 commit comments