Python profile viewer
Clone or download
nschloe Merge pull request #34 from BoboTiG/fix-install-warning
Fix a resource warning at installation
Latest commit 04ae171 Nov 6, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci remove coverage badge Jun 27, 2018
test try to fix coverage reports Jun 27, 2018
tuna version bump Sep 11, 2018
.eslintrc js: missing semicolons Jun 27, 2018
.gitignore add gitignore Jun 27, 2018
Makefile better error handling Aug 15, 2018
codecov.yml add codecov config Jul 4, 2018 Fix a resource warning at installation Oct 28, 2018


CircleCI Code style: black PyPi Version GitHub stars

tuna is a Python profile viewer inspired by the amazing SnakeViz.

Create a runtime profile with

python -mcProfile -o

or an import profile with

python -X importprofile 2> import.log

and show it with


But tuna doesn't show the whole call tree!

Right, and that's because the whole timed call tree cannot be retrieved from profile data. Python developers made the decision to only store parent data in profiles because it can be computed with little overhead. To illustrate, consider the following program.

import time

def a(t0, t1):

def b():
    return a(1, 4)

def c(t):

def d(t):

if __name__ == "__main__":
    a(4, 1)

The root process (__main__) calls a() which spends 4 seconds in c() and 1 second in d(). __main__ also calls b() which calls a(), this time spending 1 second in c() and 4 seconds in d(). The profile, however, will only store that c() spent a total of 5 seconds when called from a(), and likewise d(). The information that the program spent more time in c() when called in root -> a() -> c() than when called in root -> b() -> a() -> c() is not present in the profile.

tuna only displays the part of the timed call tree that can be deduced from the profile:


tuna is available from the Python Package Index, so simply type

pip install -U tuna

to install or upgrade.


To run the tuna unit tests, check out this repository and type



To create a new release

  1. bump the __version__ number,

  2. tag and upload to PyPi:

    make publish


tuna is published under the MIT license.