Skip to main content

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


Download files

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

Source Distribution

flowtrace-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

flowtrace-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

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

Hashes for flowtrace-0.1.0.tar.gz
Algorithm Hash digest
SHA256 133bec8b78e81e2c02633efb35211bdbf8c5f468141c7817f0558b8e00d41faa
MD5 411e120519c2e6a70f63160f54328cfd
BLAKE2b-256 0b89089e5a1fe67f14f9b3fb360a02e61275067ca355f2240ae6b85b58835e63

See more details on using hashes here.

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

Hashes for flowtrace-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9491c4f5ce9ba5981e7f8ba4132dc3705dd7bfb4138a9c3554b9b3779d8e5f4d
MD5 836bebe065ff1982a5702c1db55e3032
BLAKE2b-256 392a2558a2583bb389a69d5c288a9fd72df87964a432d9d9ae36a83e5173514b

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