Skip to main content

Trevis

Easily visualize recursive functions in the console.

from trevis import recursion

@recursion
def fib(n: int) -> int:
    if n < 2: return n
    return fib(n - 1) + fib(n - 2)

fib(4)
# output
fib(4) → 3
├╴fib(3) → 2
│ ├╴fib(2) → 1
│ │ ├╴fib(1) → 1
│ │ └╴fib(0) → 0
│ └╴fib(1) → 1
└╴fib(2) → 1
  ├╴fib(1) → 1
  └╴fib(0) → 0

Features

  • 🕹️ Interactive mode: Review each function execution interactively, advancing to the next step by pressing Enter. This mode enhances comprehension and debugging by providing a clear visual representation of each step. Enable with recursion(interactive=True).
  • 🌈 Syntax highlighting (upcoming): Enable syntax highlighting in the tree for improved readability. Coming in a future version.
  • 🎲 Non-deterministic function visualization (upcoming): Visualize of all possible execution paths for non-deterministic functions. Coming in a future version.

Installation

Ensure you have Python 3.6 or higher, then install Trevis using pip:

pip install trevis

Contribution

Contributions are welcome! Feel free to submit an issue or pull request.

License

Trevis is licensed under the MIT License.

Metadata

Release files for trevis 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trevis 0.0.1
File Size Uploaded
trevis-0.0.1.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trevis 0.0.1
File Interpreter ABI Platform
trevis-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / trevis-0.0.1.tar.gz

Download URL trevis-0.0.1.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4ab2131c2fceb54dd28c40aa9bf62fad08cd4ae75841fb72c024c351cc83ff53
BLAKE2b-256 checksum
How to use checksums
968fc729fe947e1f0e19b1d50d3fd726888910c2dce5e02ff729ce1c315f0c8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release files / trevis-0.0.1-py3-none-any.whl

Download URL trevis-0.0.1-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
988439d356a79b900d36be196665395c30009bf2fb8c8437140806ab54dc735d
BLAKE2b-256 checksum
How to use checksums
14d366f7709ae368069716fe2bfa754d5d4f3fc25f2c2e718ff1b5dd7bcfb425
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page