A Python dynamic debugger inspired by Arthas, using Python 3.14's safe external debugger interface
Project description
Peeka
中文 | 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 |
|---|---|---|
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
simpleevalinstead of Pythoneval. - 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" -d 3
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 |
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
- Inspired by Alibaba Arthas
- Safe expression evaluation powered by simpleeval
- Python 3.14+ attach path based on PEP 768
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file peeka-0.1.12.tar.gz.
File metadata
- Download URL: peeka-0.1.12.tar.gz
- Upload date:
- Size: 135.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c5036a98ee8880d368db301cd8312f6308e27d63d50b8eb31e8e1cb5b05e70a
|
|
| MD5 |
96801c1de56eca33c1d372436f8c692b
|
|
| BLAKE2b-256 |
c6feab06089f6273097dfa24b7858b37fe53005a73d454be8cec19b63705daf8
|
Provenance
The following attestation bundles were made for peeka-0.1.12.tar.gz:
Publisher:
publish-pypi.yml on peeka-project/peeka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
peeka-0.1.12.tar.gz -
Subject digest:
3c5036a98ee8880d368db301cd8312f6308e27d63d50b8eb31e8e1cb5b05e70a - Sigstore transparency entry: 1474605452
- Sigstore integration time:
-
Permalink:
peeka-project/peeka@96724de4e99e4dc70474dfb16a0cc23f244abe13 -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/peeka-project
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@96724de4e99e4dc70474dfb16a0cc23f244abe13 -
Trigger Event:
push
-
Statement type:
File details
Details for the file peeka-0.1.12-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: peeka-0.1.12-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 181.0 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40a0fd7395d66a3c99816ae776d89d22f2851d90e5962ef26a1f7261f72a664a
|
|
| MD5 |
064607a442764ba471fe30179072b6cc
|
|
| BLAKE2b-256 |
20157e68d90bd0770dfaf95a1bd30ced612d34352bf253b7dbb198db2c4bc805
|
Provenance
The following attestation bundles were made for peeka-0.1.12-cp312-cp312-manylinux_2_34_x86_64.whl:
Publisher:
publish-pypi.yml on peeka-project/peeka
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
peeka-0.1.12-cp312-cp312-manylinux_2_34_x86_64.whl -
Subject digest:
40a0fd7395d66a3c99816ae776d89d22f2851d90e5962ef26a1f7261f72a664a - Sigstore transparency entry: 1474605491
- Sigstore integration time:
-
Permalink:
peeka-project/peeka@96724de4e99e4dc70474dfb16a0cc23f244abe13 -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/peeka-project
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@96724de4e99e4dc70474dfb16a0cc23f244abe13 -
Trigger Event:
push
-
Statement type: