Skip to main content

tuna

Performance analysis for Python.

PyPi Version PyPI pyversions GitHub stars Downloads

Discord

gh-actions Code style: black code style: prettier

tuna is a modern, lightweight Python profile viewer inspired by SnakeViz. It handles runtime and import profiles, has minimal dependencies, uses d3 and bootstrap, and avoids certain errors present in SnakeViz (see below) and is faster, too.

Create a runtime profile with

python -mcProfile -o program.prof yourfile.py

or an import profile with

python -X importtime yourfile.py 2> import.log

and show it with

tuna program.prof

Why tuna doesn't show the whole call tree

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):
    c(t0)
    d(t1)


def b():
    a(1, 4)


def c(t):
    time.sleep(t)


def d(t):
    time.sleep(t)


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

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. SnakeViz, on the other hand, tries to construct the entire call tree, but ends up providing lots of wrong timings.

SnakeViz output. Wrong. tuna output. Only shows what can be retrieved from the profile.

Installation

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

pip install tuna

to install.

IPython magics

tuna includes a tuna line / cell magic which can be used as a drop-in replacement for the prun magic. Simply run %load_ext tuna to load the magic and then call it like %tuna sleep(3) or

%%tuna
sleep(3)

prun is still used to do the actual profiling and then the results are displayed in the notebook.

Development

After forking and cloning the repository, make sure to run just dep to install additional dependencies (bootstrap and d3) which aren't stored in the repo.

License

This software is published under the GPLv3 license.

Release files for tuna 0.5.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tuna 0.5.15
File Size Uploaded
tuna-0.5.15.tar.gz 162.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tuna 0.5.15
File Interpreter ABI Platform
tuna-0.5.15-py3-none-any.whl Python 3 none any Details

Total release size:322.9 kB

Release files / tuna-0.5.15.tar.gz

Download URL tuna-0.5.15.tar.gz
Size 162.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0109ab102374ecf5d47f950267b516b6009c3cf48e8caba3b2c859ed3f6fb996
BLAKE2b-256 checksum
How to use checksums
cf792321629fc8838b07ca0b2851a8e4ebf99d4a36c2d3fecd3dc391c9dba9a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 19, 2026.

Transparency log

Release files / tuna-0.5.15-py3-none-any.whl

Download URL tuna-0.5.15-py3-none-any.whl
Size 160.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
889a62552067133e86851cebb1042bfc28242141ea80d4ae9c64142d86e060a3
BLAKE2b-256 checksum
How to use checksums
a6c7622f828d2d6e73826f46d7589f1d3be9812cef5827076040c9fa06b80f7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.15 This release

2 release files

0.5.14

2 release files

0.5.13

2 release files

0.5.12

2 release files

0.5.11

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page