Skip to content

Instantly share code, notes, and snippets.

@yuvve
Last active June 4, 2024 11:21
Show Gist options
  • Save yuvve/2b87176e5b26cb8e0851fe4c2689e87e to your computer and use it in GitHub Desktop.
Save yuvve/2b87176e5b26cb8e0851fe4c2689e87e to your computer and use it in GitHub Desktop.
VSCode launch settings for Python, Pytest and Scrapy, that add the VSCode workspace to path
// Using the launch settings below,
// you can debug (F5) modules inside subfolders
// that import files from parent- or sister folders
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Run Module With Path",
"type": "python",
"request": "launch",
"program":"${file}",
"justMyCode": true,
"env":{
"PYTHONPATH":"${workspaceFolder}"
}
},
{
"name":"Pytest: Run Module With Path",
"type": "python",
"request":"launch",
"module": "pytest",
"args": ["${file}", "-s"],
"env":{
"PYTHONPATH":"${workspaceFolder}"
}
},
{
"name":"Pytest: Run All Tests With Path",
"type": "python",
"request":"launch",
"module": "pytest",
"args": ["-s"],
"env":{
"PYTHONPATH":"${workspaceFolder}"
}
},
{
"name": "Crawl with scrapy",
"type": "python",
"request": "launch",
"module": "scrapy",
"cwd": "${fileDirname}",
"args": [
"crawl",
"crawlingNLP",
"-a",
"start_urls=\"https://bdx.se\"",
"-L",
"ERROR"
],
"justMyCode": false,
"console": "integratedTerminal",
"env":{
"PYTHONPATH":"${workspaceFolder}"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment