To configure the debugger in VSCode to run the debug_manifest, follow these steps:
- Clone or Open the existing
airbyte-python-cdkproject in VSCode. - Click on the Run and Debug icon in the Activity Bar on the side of the window.
- Click on the
create a launch.json filelink to create a new configuration file. - Select
Pythonfrom the list of environments. - Replace the contents of the generated
launch.jsonfile with the following configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Debug Manifest",
"type": "debugpy",
"request": "launch",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/debug_manifest",
"python": "<PATH_TO_CDK_ENV>/bin/python",
"module": "debug_manifest",
"args": [
// SPECIFY THE COMMAND: [spec, check, discover, read]
"read",
// SPECIFY THE CONFIG
"--config",
// PATH TO THE CONFIG FILE
"resources/config.json",
// SPECIFY THE CATALOG
"--catalog",
// PATH TO THE CATALOG FILE
"resources/catalog.json",
// SPECIFY THE STATE (optional)
// "--state",
// PATH TO THE STATE FILE
// "resources/state.json",
// ADDITIONAL FLAGS, like `--debug` (optional)
"--debug"
]
}
]
}- Save the
launch.jsonfile. - Install
CDK dependenciesby runningpoetry install --all-extras - Replace the
"python": "<PATH_TO_CDK_ENV>/bin/python"with the correct interpreterPATHpointing to theCDK envinstalled from Step7(usewhich pythonto 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.
- These resources are ignored by
git, in the.gitignore, thus should not be committed
- Put the
config.jsoninside the/airbyte_cdk/debug_manifest/resources(this will hold thesource input configuration). - Put the
catalog.jsoninside the/airbyte_cdk/debug_manifest/resources(this will hold theconfigured catalogfor the target source). - Put the
manifest.yamlinside the/airbyte_cdk/debug_manifest/resources - (Optional) Put the
state.jsoninside the/airbyte_cdk/debug_manifest/resources
- Set any necessary breakpoints in your code, or
CDKcomponents code. - Press
F5/Shift + CMD + D/ click the green play button in theRun and Debugview to start debugging. - Iterate over the
2and3, to debug yourmanifest-onlysource.
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.