Skip to main content

Function execution tracing, visualization, and narrative builder for Python apps.

Project description

TraceMorph

TraceMorph adalah library Python untuk melacak eksekusi fungsi, membangun visualisasi call-chain, serta menghasilkan narasi error berbasis AI (via LLM API).

🚀 Fitur

  • Dekorator tracing fungsi otomatis
  • Pelacakan exception global
  • Visualisasi call-stack dan dependensi fungsi
  • Ekspor hasil trace ke JSON
  • Narasi human-readable berbasis LLM prompt engineering
  • Bisa diintegrasikan ke middleware, testing, atau backend

🧠 Contoh Penggunaan

from tracemorph import trace

@trace
def bagi(a, b):
    return a / b

bagi(10, 2)

contoh 2

from tracemorph.core.tracer import trace
from tracemorph.core.builder import TraceBuilder

@trace()
def error_prone(x, y):
    return x / y  # Bisa error kalau y=0

if __name__ == "__main__":
    try:
        error_prone(10, 0)
    except Exception:
        pass  # biarkan decorator handle log trace-nya

    # Ambil data trace terakhir lengkap dengan narasi berwarna
    data = TraceBuilder.build_latest_and_export()

    if data:
        print(data['colored_narrative'])  # Print narasi berwarna rapi di terminal
    else:
        print("No trace found.")

contoh 3

from tracemorph import trace, TraceBuilder

@trace
def test(x):
    return x * 2

test(10)

print(TraceBuilder.build_narrative_for_last()[0])

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

tracemorph-0.1.3.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

tracemorph-0.1.3-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file tracemorph-0.1.3.tar.gz.

File metadata

  • Download URL: tracemorph-0.1.3.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for tracemorph-0.1.3.tar.gz
Algorithm Hash digest
SHA256 276150ac0e23f6380df6344bef670e88313d4729481f52ba7eb6070d537dc1e7
MD5 d54a919ced4fbf3db1b5ea9ff799b07c
BLAKE2b-256 e665c206089135e4075c5da1eaef8567721315a1fd389303031dc194ffae1d14

See more details on using hashes here.

File details

Details for the file tracemorph-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: tracemorph-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for tracemorph-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 880ad71e1e5df240fc4045da18ff91cca64143aa2c5edd5934c48d9eb5a9c826
MD5 ac451e7aeee688f926e51f655ea38133
BLAKE2b-256 7b1581b56d78c70d13e666d655a3a23d06db9d40b3693ded38893c1c6d6d17e9

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