[RFC] fastapi inspect
& fastapi attach
- wrap Python 3.14’s asyncio cli
and pdb
for live debugging
#214
Unanswered
mahimairaja
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
Overview
Python 3.14 added first-class process-introspection for asyncio and a remote-attach mode for pdb. Surfacing these via FastAPI’s CLI would give developers “works everywhere” observability/debugging for live FastAPI services, without extra agents or pre-instrumentation.
Read more on: PEP 768 and Asynchronous CLI
Proposed UX (small & incremental):
fastapi inspect --pid <PID> [--tree]
A pretty wrapper over python -m asyncio ps (flat task table) and python -m asyncio pstree (hierarchical coroutine tree). These 3.14 tools can introspect async tasks across threads.
fastapi attach --pid <PID>
A thin wrapper over python -m pdb -p for interactive debugging of a running process. This is a new 3.14 feature built atop the safe external debugger interface.
Notes / safety:
Operating System
Linux, Windows, macOS
Operating System Details
POSIX
: typically same user or root to attach to another PID.Windows
: run in an elevated console when required.Python Version
Python 3.14+
Additional Context
If maintainers agree, I’m happy to help with a small PR adding these two subcommands to fastapi-cli. Would love to discuss. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions