benfred/py-spy ? reverse-engineered prompt

Reverse engineered prompt

Build me a fast Python profiler called py spy that can inspect a running Python program without restarting it or adding tracing code.

I want a command line tool with three main modes, one that records a profile to a file for flame graphs or speedscope, one that shows a live top style view of where time is going, and one that dumps the current stack traces for all Python threads. It should work on Linux, macOS, Windows, and FreeBSD, and be safe enough to use on production processes because it runs outside the target program and has very low overhead.

Please make it able to attach either by process id or by running a Python command directly. If possible, also support profiling subprocesses and native extensions, and include helpful output for locals when dumping stacks. Use the current docs online if you need to check details for the command flags and output formats.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab