Skip to main content

A package to trace recursive function calls and generate a recursion tree

Project description

Recursion Trace

Overview

recursion_trace is a Python package that provides a decorator to trace recursive function calls. It generates a visual recursion tree using Graphviz, making it easier to understand and debug recursive algorithms.

Features

  • Trace single and mutual recursion.
  • Generate a Graphviz plot to visualize the recursion tree.
  • Capture function arguments, return values, and recursion depth.

Installation

pip install recursion-trace

Usage

from recursion_trace import trace_recursion, show_recursion_tree

@trace_recursion
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n - 1)

result = factorial(5)

# Show the recursion tree
show_recursion_tree(factorial.logs)

Dependencies

  • graphviz

Author

Swayam Singh

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

recursion_trace-0.1.4.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file recursion_trace-0.1.4.tar.gz.

File metadata

  • Download URL: recursion_trace-0.1.4.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for recursion_trace-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2fe472c80af0439d9dc18f2622f4fab5bb70d6c512f7e7485d96e1fb61de051c
MD5 f9d8b29f2732deb7f8b3b1bf7a6049e6
BLAKE2b-256 a0c621ff3abbeb41bf4902d95c4894f310d0bb9ce8e34387150d956f4729550f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page