Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement][docs] vscode launch.json example #1952

Open
Lewiscowles1986 opened this issue Jul 25, 2024 · 2 comments
Open

[enhancement][docs] vscode launch.json example #1952

Lewiscowles1986 opened this issue Jul 25, 2024 · 2 comments
Labels
enhancement PR welcome We would welcome and review a PR addressing this issue

Comments

@Lewiscowles1986
Copy link

Description

Hi, I own licenses to JetBrains products, but prefer to mostly work in VSCode
Launching connexion in VSCode for good local-dev is harder than it needs to be.

Sample launch.json (app.py)

Assuming your app is in app.py, and you are just spinning this up without much of an app framework yet

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger:app.py",
            "type": "debugpy",
            "request": "launch",
            "module": "uvicorn",
            "env": {
            },
            "args": [
                "--reload",
                "--port",
                "5001",
                "--host",
                "0.0.0.0",
                "app:app",
            ],
            "jinja": true,
            "autoStartBrowser": false,
            "justMyCode": false,
            "cwd": "${workspaceFolder}",
        },
    ],
}

Sample launch.json (module loading)

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger:{your_module}",
            "type": "debugpy",
            "request": "launch",
            "module": "uvicorn",
            "env": {
            },
            "args": [
                "--reload",
                "--port",
                "5001",
                "--host",
                "0.0.0.0",
                "your_module:app",
            ],
            "jinja": true,
            "autoStartBrowser": false,
            "justMyCode": false,
            "cwd": "${workspaceFolder}",
        },
    ],
}

Of course you'd need uvicorn for this purpose, but it seems to work across AsyncApp, and FlaskApp.

@RobbeSneyders RobbeSneyders added enhancement PR welcome We would welcome and review a PR addressing this issue labels Dec 23, 2024
@RobbeSneyders
Copy link
Member

I do not use VSCode myself, but would welcome a PR adding this by someone that does.

@Lewiscowles1986
Copy link
Author

I'm happy to PR it. Should come in before the new year, just out at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PR welcome We would welcome and review a PR addressing this issue
Projects
None yet
Development

No branches or pull requests

2 participants