microsoft / microsoft/vscode-python-debugger

Split FastAPI debug config into file-scoped and project-scoped options

未關閉
#1,045 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

triage-needed
主要語言
TypeScript
星號
181
分支
126
平均合併
2 天 3 小時
30 天內合併 PR
3

描述

Hey folks 👋 I work at @fastapilabs and maintain https://github.com/fastapi/fastapi-vscode. I've been looking at the broader FastAPI experience in VS Code and wanted to open an issue to discuss an improvement we've been discussing related to debugging.

The current FastAPI debug configurations (the snippet from microsoft/vscode-python#14606 and the dynamic provider added in #19505) launch the app via uvicorn ...:app --reload and rely on hand-rolled main.py detection. This predates the fastapi CLI (fastapi run / fastapi dev), which provides built-in app discovery via pyproject.toml or default file locations.

For an improved experience, I'd like to propose splitting the current debugging experience into two options:

  • Debug FastAPI with current file - runs fastapi run ${file} against the currently active file. This is optimal for single-file apps or quickly debugging a specific entry point.

  • Debug FastAPI - runs plain fastapi run and lets the CLI discover the app via pyproject.toml or default file locations. Doing this would also remove the extension's own detection logic in favor of the FastAPI CLI's resolution, and give users a clearer choice between file-scoped and project-scoped debugging.

Wanted to gauge whether there'd be appetite for this change. I already have a branch with most of this working locally and would be happy to put up a PR if it makes sense.

Thanks!

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先檢視目前的 FastAPI 偵錯設定與 issue 中描述的動態 provider,以及參照的 vscode-python 變更。將它們對 uvicorn 和 main.py 的偵測行為,與 fastapi CLI 透過 pyproject.toml 進行檔案和專案探索的行為進行比較。當偵錯體驗透過 CLI 明確提供目前檔案和專案範圍的個別選項時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
fastapi, python, typescript
領域
devtools, tooling
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。