Skip to main content

  Peeka

PyPI Release Tests License Docs

中文 | English

Runtime diagnostics for Python applications. Peeka attaches to a running Python process and lets you observe function calls, traces, stacks, logs, memory, threads, and hot paths without changing application code.

It uses PEP 768 on Python 3.14+, with debugger-based fallback for Python 3.8.1-3.13.

Screenshots

Dashboard Watch Trace
Peeka dashboard view Peeka watch view Peeka trace view

Key Features

  • Non-invasive - Inject observation logic at runtime and restore it on detach or reset.
  • Real-time streaming - Stream observations over Unix domain sockets with low latency.
  • Production-minded - Keep overhead bounded with fixed-size buffers and graceful recovery.
  • Safe filtering - Evaluate conditions with simpleeval instead of Python eval.
  • Dual interface - Use JSONL CLI for agents and automation, or TUI for human exploration.

What Peeka Is For

  • Inspect a live service when logs and metrics are not enough.
  • Watch function inputs, return values, exceptions, and latency in real time.
  • Trace call trees to find where time is spent inside one request or job.
  • Capture call stacks, thread state, memory summaries, loggers, and runtime objects.

Two Interfaces

Peeka is designed for two different operators:

Interface Designed for Why it exists
CLI Agents and automation Stable commands with JSONL output for scripts, pipelines, and coding agents
TUI Humans An interactive terminal workspace for exploring live diagnostics without building shell pipelines

Install

# CLI only: best for agents, scripts, and headless environments.
pip install peeka

# CLI + TUI: best when a human will inspect the process interactively.
pip install "peeka[tui]"

Peeka supports Python 3.8.1+. The TUI requires Python 3.9+.

For Python 3.8.1-3.13, attaching needs debugger support: GDB on Linux or LLDB on macOS. On Linux, ptrace permissions must allow attaching to the target process.

Python Support

Python version CLI TUI Attach mechanism Main dependency
3.14+ Yes Yes PEP 768 sys.remote_exec() Same UID or CAP_SYS_PTRACE
3.9-3.13 Yes Yes GDB on Linux, LLDB on macOS Debugger support and attach permission
3.8.1-3.8.x Yes No GDB on Linux, LLDB on macOS Debugger support and attach permission

See the documentation for platform-specific setup and troubleshooting.

Quick Start

CLI for agents and automation

# Attach to a running Python process.
peeka-cli attach <pid>

# Observe function calls.
peeka-cli watch "module.Class.method" -n 5

# Trace a call tree.
peeka-cli trace "module.func"

The CLI emits structured JSONL, so agents and scripts can parse, filter, and persist observations reliably.

TUI for humans

# Launch the TUI.
peeka

The TUI provides an interactive dashboard for browsing watches, traces, stacks, memory, threads, logs, and other runtime views.

Patterns use fully qualified function names such as module.function or module.Class.method.

Core Commands

Command Purpose
attach / detach Connect to or leave a target process
watch Observe function arguments, return values, exceptions, and latency
trace Trace nested calls and timing breakdowns
stack Capture call stacks at function entry
monitor / top Inspect periodic metrics and hot functions
memory / thread / logger Inspect runtime memory, threads, and loggers
inspect / sc / sm Inspect objects and search classes or methods
reset Remove injected observations and restore wrapped functions
run Start a script with Peeka injected from launch

Gevent Compatibility

Peeka separates its gevent support into two layers:

  • Control plane: attach, the in-process agent socket, RPL primitives, and patch-status. This layer avoids target-process monkey-patched socket/threading primitives.
  • Data plane: observation commands such as trace and top. These commands report their gevent compatibility in JSONL meta fields when runtime behavior is degraded.
Command No gevent gevent imported gevent patched / active hub
watch safe safe safe
monitor safe safe safe
stack safe safe safe
trace full trace backend full trace backend sys_monitoring (Python 3.12+); wrapper_only (Python <3.12)
top frame-walk sampling frame-walk sampling greenlet_aware_sampling with greenlet_blind meta

When Peeka detects gevent monkey patching, trace behavior depends on the Python version:

  • Python 3.12+: Uses sys.monitoring (per-tool, no global tracer) — full direct-callee tracing available under gevent.
  • Python <3.12: Falls back to wrapper_only tracing (root duration only, no callees) — sys.settrace would interfere with gevent's greenlet hub.

Example metadata on Python 3.12+ under gevent:

{
  "meta": {
    "gevent_state": "patched",
    "backend": "sys_monitoring",
    "greenlet_blind": false,
    "degraded_reason": null
  }
}

For gevent targets, prefer watch when wrapper-level entry/exit observations are enough. On Python 3.12+, trace provides full direct-callee diagnostics even under gevent. On older Python, trace falls back to timing the root call only. top remains available through a chained greenlet.settrace backend that preserves any existing greenlet tracer, while still marking greenlet_blind because suspended greenlets cannot be fully enumerated.

Read More

  • Documentation - command reference, TUI usage, installation details, and troubleshooting.
  • Scenario guide - practical debugging walkthroughs.
  • Demo guide - command-by-command examples against the demo app.
  • Attach internals - how Peeka injects diagnostics into a running Python interpreter.
  • Roadmap - planned work and product direction.

License

Apache License 2.0

Acknowledgments

Metadata

Release files for peeka 0.1.21

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

Source distribution (sdist)

Source distribution for peeka 0.1.21
File Size Uploaded Provenance Actions
peeka-0.1.21.tar.gz 269.2 kB With provenance Details for peeka-0.1.21.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for peeka 0.1.21
File Actions
peeka-0.1.21-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details for peeka-0.1.21-cp38-abi3-musllinux_1_2_x86_64.whl
peeka-0.1.21-cp38-abi3-musllinux_1_2_aarch64.whl CPython 3.8 abi3 Linux musl 1.2+ ARM64 Details for peeka-0.1.21-cp38-abi3-musllinux_1_2_aarch64.whl
peeka-0.1.21-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for peeka-0.1.21-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
peeka-0.1.21-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for peeka-0.1.21-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
peeka-0.1.21-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for peeka-0.1.21-cp38-abi3-macosx_11_0_arm64.whl
peeka-0.1.21-cp38-abi3-macosx_10_9_x86_64.whl CPython 3.8 abi3 macOS 10.9+ x86-64 Details for peeka-0.1.21-cp38-abi3-macosx_10_9_x86_64.whl

Total release size: 2.4 MB

Release files / peeka-0.1.21.tar.gz

Download URL peeka-0.1.21.tar.gz
Size 269.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9a99b1fb70171cf814fec1339b505078fa09bef98e1151c2417a699536a994a5
BLAKE2b-256 checksum
How to use checksums
d7c03fa8155dd8e985cb25988a666ba81dfc2c46ba226ea7917d2ccc1f286b0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Release files / peeka-0.1.21-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL peeka-0.1.21-cp38-abi3-musllinux_1_2_x86_64.whl
Size 349.7 kB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
eb05c1650d0bcc9b395243db1bc0b606b38e1ccaf01992a75fcc35059735fb12
BLAKE2b-256 checksum
How to use checksums
68bfc8c91c0d6fbc0cfadb51cb209deecc407036d5dd300c220a7e7a4f696332
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Release files / peeka-0.1.21-cp38-abi3-musllinux_1_2_aarch64.whl

Download URL peeka-0.1.21-cp38-abi3-musllinux_1_2_aarch64.whl
Size 350.1 kB
Tags CPython 3.8 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
ebf0d46535fed0e274673d3d3c7f4c0454a531b1e6b310bf28ce81f4d65cebec
BLAKE2b-256 checksum
How to use checksums
3dbc28eae3d4ff0c04fb391b67759fc8933202651103c8a8e6b066d26c7809a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Release files / peeka-0.1.21-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL peeka-0.1.21-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 350.2 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
864c5cc1ae871e9df11e1f4b8a0c266107b11819224574bdcfc9571dba632425
BLAKE2b-256 checksum
How to use checksums
d1f43f0dd39edc8233e5919d661d4386e79c4a05ac753d5e87b3ea68d3096bf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Release files / peeka-0.1.21-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL peeka-0.1.21-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 350.5 kB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a854bfe0b16c4bed8d539c902da17f87e276dc54a61d11e30d9311ba11271282
BLAKE2b-256 checksum
How to use checksums
208e8717e98ecd1b03ee0826289b2b046d776bdb15072d7414032de4509ee145
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Release files / peeka-0.1.21-cp38-abi3-macosx_11_0_arm64.whl

Download URL peeka-0.1.21-cp38-abi3-macosx_11_0_arm64.whl
Size 340.9 kB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
617186b019ee3562d543e40224fe7ff91d0fafaea7c10c593ef355dae01718e2
BLAKE2b-256 checksum
How to use checksums
b04eb18a1bec03a73f52c72e09c0d3b2426238ccbbc7eab1f4317e12a8bca1a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Release files / peeka-0.1.21-cp38-abi3-macosx_10_9_x86_64.whl

Download URL peeka-0.1.21-cp38-abi3-macosx_10_9_x86_64.whl
Size 340.5 kB
Tags CPython 3.8 abi3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
d9f1d92e9808922f22a113bde6bd9c5a1c7b9dab7878e34dd4122f9b733f080b
BLAKE2b-256 checksum
How to use checksums
cabbd115800a60b62934540bce400b1291ed648dd8d0b2cac8a925c8fdef7444
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Security for peeka 0.1.21

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.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for peeka-0.1.21.tar.gz

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 Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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