Registry / observability / tuna
library0.5.15pypypiunverified

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 tuna
INSTALL
IMPORT
SIG · TUNA
T
tuna
observabilitypythonv0.5.15
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.15 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.4MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tuna CLI
tuna your_profile.prof
from tuna import visualize
Tuna is primarily a command-line tool or an IPython magic, not a library meant for direct Python imports for its core visualization functionality. It operates on profile files generated by cProfile or importtime.
%tuna IPython magic
%load_ext tuna %tuna your_code()
%tuna your_code() (without loading extension)
The IPython magic must be loaded first in a session before it can be used.

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`.

import cProfile import time def func_a(): time.sleep(0.1) def func_b(): func_a() time.sleep(0.05) def main(): func_a() func_b() profile_file = 'my_program.prof' cProfile.run('main()', profile_file) print(f"Profile saved to {profile_file}. View with: tuna {profile_file}") # To view import profile (run from terminal): # python -X importtime -c "import pandas" 2> import.log # print("Import profile saved to import.log. View with: tuna import.log")
tuna --version
Debug
Known issues
gotchaTuna's visualization of the call tree is intentionally incomplete compared to some other profilers (e.g., older SnakeViz versions). It only displays the part of the timed call tree that can be directly deduced from the profile data, as Python's profilers (like cProfile) do not store the full contextual call hierarchy (e.g., differentiating calls to the same function from different parents).
fix
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.
affects: All versions
gotchaWhen using `tuna` as an IPython magic (e.g., in Jupyter notebooks), you must explicitly load the extension first.
fix
Always run `%load_ext tuna` at the beginning of your IPython session or notebook before attempting to use `%tuna` or `%%tuna` magics.
affects: All versions
Upgrade
Version history
0.5.15latest on PyPI · released May 19, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.10 or newer. Relies on built-in cProfile and -X importtime.
Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
tuna — pip install tuna · libregistry