Skip to main content

py-spy-tui

A Rust terminal UI for py-spy, packaged so users can install it with:

pip install py-spy-tui
py-spy-tui

py-spy-tui depends on the py-spy Python package, so installing the TUI also installs the profiler binary on supported platforms.

Current Features

  • Groups Python processes by distributed training metadata, process tree, runtime prefix, working directory, and command fingerprint.
  • Detects virtualenv, uv-managed Python, Conda, pyenv, and system runtimes.
  • Shows PyTorch rank metadata when process environment is readable.
  • Explains Linux rootless profiling setup before asking sudo to attach to a process.
  • Uses sudo -v for authentication and never reads or stores a password.

Usage

py-spy-tui

Non-interactive checks:

py-spy-tui --help
py-spy-tui --version

Keys:

  • Enter: record the selected process or process group for 30 seconds.
  • d: run py-spy dump for the selected process or process group.
  • r: refresh process groups.
  • Space: expand or collapse a group.
  • j / k or arrow keys: move selection.
  • PageUp / PageDown: scroll output.
  • q: quit.

When a group is selected, py-spy-tui runs one py-spy command per process. This is useful for torchrun and distributed PyTorch training, where ranks are often sibling processes rather than children of a single attach target.

Reports

Every record run creates a recognizable report folder in the current directory:

py-spy-report-<target-name>-<unix-timestamp>/
  raw/
    pid-1234.svg
    pid-1235.svg
  report.md
  report.json

The raw/ folder keeps py-spy's original SVG records. report.md is written for humans, and report.json is structured so you can pass the folder to an LLM and ask it to compare hot frames, rank imbalance, blocking stacks, and data-loading stalls.

Linux Rootless Profiling

Attaching to an existing process often requires elevated permissions on Linux. To allow same-user profiling without sudo:

sudo sysctl kernel.yama.ptrace_scope=0

To keep that setting after reboot:

echo 'kernel.yama.ptrace_scope=0' | sudo tee /etc/sysctl.d/10-py-spy-tui.conf
sudo sysctl --system

This changes system-wide ptrace policy for same-user debugging. Use sudo from the TUI when you prefer not to change the host setting.

Build

Local full check:

just build-all

That runs formatting, tests, clippy, clears dist/, builds a wheel, and smoke-checks it. It also runs just verify-dist, which fails unless dist/ contains only wheels and includes the required macOS and Linux manylinux x86_64/aarch64 wheel tags.

Build a local wheel:

just dist-local

Linux release wheels are built as manylinux wheels with Zig so they work on most supported Linux distributions:

just dist-linux-x86_64
just dist-linux-aarch64

Check release artifacts without rebuilding:

just verify-dist

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

py_spy_tui-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (645.3 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

py_spy_tui-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (613.6 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

py_spy_tui-0.1.6-py3-none-macosx_11_0_arm64.whl (552.1 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file py_spy_tui-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: py_spy_tui-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 645.3 kB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for py_spy_tui-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 695381efba403283d916234cd3ebe26f74150cde8dd77075b62fc778b6776ed7
MD5 d0845c25d4bd0fd27769b4685986b16b
BLAKE2b-256 2239f5d59b3d2c041c00285832e2c8039f3ec2677deedc911467810053436ee7

See more details on using hashes here.

File details

Details for the file py_spy_tui-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: py_spy_tui-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 613.6 kB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for py_spy_tui-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 37183ab5afd5f108a1aecc2fe8b666f6797770332477fc35cabab598d5b913ac
MD5 217018d9c49459bfb28d365dc09018fa
BLAKE2b-256 0d70d4816a9cf9e3876cdac32198d182d0f082ff9feeb192e3028bdd8e34b87d

See more details on using hashes here.

File details

Details for the file py_spy_tui-0.1.6-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: py_spy_tui-0.1.6-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 552.1 kB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for py_spy_tui-0.1.6-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 31a7af6361a70467c906ed0e7c58b2933b8172148487bd982bf9642e13780626
MD5 d1583161a956f6b3da492098d2e1da47
BLAKE2b-256 d95cfb702469a5c61766967a881fce158204042a34dec61b9a2570d41041d58f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page