Support multiple -o/--outfile flags in a single invocation

Author: ryan-crabbeCreated Jan 29, 2026Updated Jan 29, 2026

It would be useful to generate multiple output formats in one run

e.g.: pyinstrument -o output.txt -o output.html script.py

Use case: I like to get the HTML view for visual inspection and the text view to pass to an LLM, since it's fewer tokens. Currently I work around this by outputting a .pyisession file and then rendering it to HTML and text separately its a small step

Behavior:

  • Each outfile infers its renderer from the file extension (unless -r is explicitly set, which applies to all)
  • No -o or single -o behavior is unchanged
  • Unrecognized extensions without -r produce a clear error