Skip to content

Test: Implement automatic configuration for FastAPI #19548

@paulacamargo25

Description

@paulacamargo25

Refs: #19452

Complexity: 3

Create Issue


Automatically detect a FastAPI application and run it with the correct Debug Configuration.

Steps

  1. Open a FastAPI Project if you already have one or you can also create one following the steps in the FastAPI Tutorial.
  2. Head over to the Run And Debug tab, and click on Show all automatic debug configurations.

Screen Shot 2022-07-25 at 2 09 44 PM

  1. A window will open with a list of options, choose Python.
  2. You should now see a list of debug options, and there should be the FastAPI option. Click it and the application should run.

Verification

  1. Make sure that the application has been executed correctly, you can put some breakpoints, to test that the debugging works.
  2. If you repeat the steps and instead of clicking the option, you click the wheel, it should open the launch.json file with the configuration prefilled. Make sure this is correct and can be debugged.
  3. Another form to show the automatic configuration is typing 'debug ' (with a space) in Quick open (⌘P) or by triggering the Debug: Select and Start Debugging command. Test that the Django Debugging recognition works here too.

Notes

FastAPI application detection works by looking for the main.py and app.py files in the root or in a subdirectory just one level lower and looking for them to have the declaration of a fastAPI application app = FastAPI(. So you can try moving the python file and changing the name, and check that the detection still works.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions