Visual Python execution analyzer using PEP 669 Monitoring API.
Project description
🌐 This document is available in other languages: Русская версия
🌀 FlowTrace — Visual Execution Analyzer for Python (3.12+)
FlowTrace is an educational library for visualizing and understanding Python code execution.
It shows how your code actually runs — which functions call which, with what arguments, what they return, and how long it all takes.
🎯 Project Goals
- Help Python developers build intuition about how the interpreter executes code.
- Provide a lightweight, fast, asyncio-compatible tracing tool.
- Enable learning through introspection — see, understand, and explain.
- Keep the output simple, textual, and readable — no web interfaces or IDE plugins.
📘 MVP (v0.1)
- Implement basic execution tracing via
sys.monitoring(PEP 669). - Support both synchronous and asynchronous function calls.
- Display call trees directly in the CLI.
- Save structured execution data in JSON.
- Include minimal documentation and usage examples.
💡 Concept
FlowTrace turns your program’s execution flow into a human-readable call tree.
from flowtrace import trace
@trace
def fib(n):
return n if n < 2 else fib(n-1) + fib(n-2)
fib(4)
Output:
fib(4)
├─ fib(3)
│ ├─ fib(2)
│ │ ├─ fib(1)
│ │ └─ fib(0)
│ └─ fib(1)
└─ fib(2)
fib(4) → 3
⚙️ Core Principles
-
Modern foundation: built on the PEP 669 Monitoring API (Python 3.12+), replacing the old sys.settrace mechanism for faster, asyncio-safe performance.
-
Simplicity first: just one decorator — @trace.
-
CLI-based output: all visualization happens in the terminal or via JSON export. The focus is on clarity and accessibility.
-
Async compatibility: supports coroutines and async tasks transparently.
-
Structured API: get structured trace data for further analysis:
data = flowtrace.get_trace_data()
🧰 Planned Features
-
Cross-platform color output.
-
output parameter for writing execution data to a file.
-
Customizable formatters (minimal / verbose styles).
-
Include/exclude filters by module or function.
-
Run comparison for analyzing behavioral differences.
🤝 Contributing
FlowTrace is open to contributors — its goal is not only to provide a tool, but to serve as a learning ground for exploring the internals of Python 3.12+.
🧠 FlowTrace is not a profiler.
It’s an X-ray of Python code — a way to see your program’s logic in motion.
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 flowtrace-0.1.0.tar.gz.
File metadata
- Download URL: flowtrace-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
133bec8b78e81e2c02633efb35211bdbf8c5f468141c7817f0558b8e00d41faa
|
|
| MD5 |
411e120519c2e6a70f63160f54328cfd
|
|
| BLAKE2b-256 |
0b89089e5a1fe67f14f9b3fb360a02e61275067ca355f2240ae6b85b58835e63
|
File details
Details for the file flowtrace-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flowtrace-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9491c4f5ce9ba5981e7f8ba4132dc3705dd7bfb4138a9c3554b9b3779d8e5f4d
|
|
| MD5 |
836bebe065ff1982a5702c1db55e3032
|
|
| BLAKE2b-256 |
392a2558a2583bb389a69d5c288a9fd72df87964a432d9d9ae36a83e5173514b
|