feat(run): add Flask and FastAPI run configurations (#6647)

Flask and FastAPI apps could only run as ordinary scripts. Adds Flask server and FastAPI run configuration types: Flask runs python -m flask run with FLASK_APP / FLASK_DEBUG (read by every Flask version), host, port and extra options; FastAPI runs python -m uvicorn <module:app> with reload, host, port and options. Both use the Python interpreter choice and debug with debugpy; under the debugger Flask runs with --no-debugger, and without subprocess attach the reloader is turned off so breakpoints still stop.

A top-level (or src/) app.py, wsgi.py, main.py or app/main.py assigning Flask(...) or FastAPI(...) to a module-level name gets a detected configuration. The list of Python run kinds is now one function (ide_run::is_python_kind) instead of copies in the host, Docker, process and SDK code.

Closes #6532

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-11-29 13:25:10 +08:00
1 джерело 9ee8f67e9f
коміт e30ae3f6b8
21 files changed
+513 -23

No files matched your search

+3
Переглянути файл
@@ -311,6 +311,9 @@ describe("catalogs", () => {
"Java",
"Python",
"Python {short}",
"FastAPI",
// The FastAPI configuration's Application placeholder.
"main:app",
"Flutter {framework}",
"Dart {dart}",
"C/C++",
+15 -1
Переглянути файл
@@ -4485,5 +4485,19 @@
"Sign in with GitHub CLI to view and review pull requests.": "Sign in with GitHub CLI to view and review pull requests.",
"Find in Documentation": "Find in Documentation",
"Previous Match": "Previous Match",
"Next Match": "Next Match"
"Next Match": "Next Match",
"Flask server": "Flask server",
"Run a Flask application with flask run": "Run a Flask application with flask run",
"Set as FLASK_APP: a module or file, optionally with the app or factory (hello:create_app()); empty finds app.py or wsgi.py": "Set as FLASK_APP: a module or file, optionally with the app or factory (hello:create_app()); empty finds app.py or wsgi.py",
"Debug mode": "Debug mode",
"FLASK_DEBUG=1: reload on code changes and show the interactive debugger in the browser": "FLASK_DEBUG=1: reload on code changes and show the interactive debugger in the browser",
"Additional options": "Additional options",
"e.g. --cert adhoc --extra-files config.toml": "e.g. --cert adhoc --extra-files config.toml",
"FastAPI": "FastAPI",
"Run a FastAPI application with uvicorn": "Run a FastAPI application with uvicorn",
"main:app": "main:app",
"The module and the FastAPI instance in it, module:attribute": "The module and the FastAPI instance in it, module:attribute",
"Reload on code changes": "Reload on code changes",
"uvicorn --reload. Debugging stops at breakpoints in the reloaded process while Attach to subprocess automatically while debugging is on (the default); with it off, debugging runs without the reloader": "uvicorn --reload. Debugging stops at breakpoints in the reloaded process while Attach to subprocess automatically while debugging is on (the default); with it off, debugging runs without the reloader",
"e.g. --reload-dir app --log-level debug": "e.g. --reload-dir app --log-level debug"
}
+15 -1
Переглянути файл
@@ -11016,5 +11016,19 @@
"Sign in with GitHub CLI to view and review pull requests.": "登录 GitHub CLI 以查看和评审拉取请求。",
"Find in Documentation": "在文档中查找",
"Previous Match": "上一个匹配项",
"Next Match": "下一个匹配项"
"Next Match": "下一个匹配项",
"Flask server": "Flask 服务器",
"Run a Flask application with flask run": "使用 flask run 运行 Flask 应用",
"Set as FLASK_APP: a module or file, optionally with the app or factory (hello:create_app()); empty finds app.py or wsgi.py": "设为 FLASK_APP:模块或文件,可附带应用或工厂函数(hello:create_app());留空时查找 app.py 或 wsgi.py",
"Debug mode": "调试模式",
"FLASK_DEBUG=1: reload on code changes and show the interactive debugger in the browser": "FLASK_DEBUG=1:代码变更时重新加载,并在浏览器中显示交互式调试器",
"Additional options": "附加选项",
"e.g. --cert adhoc --extra-files config.toml": "例如 --cert adhoc --extra-files config.toml",
"FastAPI": "FastAPI",
"Run a FastAPI application with uvicorn": "使用 uvicorn 运行 FastAPI 应用",
"main:app": "main:app",
"The module and the FastAPI instance in it, module:attribute": "模块及其中的 FastAPI 实例,格式为 module:attribute",
"Reload on code changes": "代码变更时重新加载",
"uvicorn --reload. Debugging stops at breakpoints in the reloaded process while Attach to subprocess automatically while debugging is on (the default); with it off, debugging runs without the reloader": "uvicorn --reload。调试时,只要开启「调试时自动附加到子进程」(默认开启),重新加载后的进程中的断点就会生效;关闭时调试不使用自动重新加载",
"e.g. --reload-dir app --log-level debug": "例如 --reload-dir app --log-level debug"
}