Tuna is a modern, lightweight Python profile viewer, currently at version 0.5.13. Inspired by SnakeViz, it visualizes Python runtime and import profiles, offering a faster and more accurate alternative by leveraging d3 and bootstrap for its web-based interface. The project maintains an active development status with regular minor updates.
pip install tunaVerified import paths — ran on the pinned version, not inferred.
Generate a runtime profile using Python's built-in `cProfile` module, saving the output to a file. Then, visualize the profile by running the `tuna` command-line tool with the generated profile file. Alternatively, you can profile import times by redirecting `python -X importtime` output to a log file and viewing it with `tuna`.
This is a design choice for accuracy. Understand that the displayed call tree reflects what's reliably measurable from `cProfile` output. If you need a full, but potentially less accurate, call tree, other profilers might be necessary, but Tuna prioritizes accurate timings within its scope.
Always run `%load_ext tuna` at the beginning of your IPython session or notebook before attempting to use `%tuna` or `%%tuna` magics.