trevis
Project description
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.
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
trevis-0.0.1.tar.gz
(3.2 kB
view details)
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 trevis-0.0.1.tar.gz.
File metadata
- Download URL: trevis-0.0.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ab2131c2fceb54dd28c40aa9bf62fad08cd4ae75841fb72c024c351cc83ff53
|
|
| MD5 |
fa8bb2cadef236883622599a7c5b15b5
|
|
| BLAKE2b-256 |
968fc729fe947e1f0e19b1d50d3fd726888910c2dce5e02ff729ce1c315f0c8d
|
File details
Details for the file trevis-0.0.1-py3-none-any.whl.
File metadata
- Download URL: trevis-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
988439d356a79b900d36be196665395c30009bf2fb8c8437140806ab54dc735d
|
|
| MD5 |
156204b55e4ff36b786950aed6fc14e5
|
|
| BLAKE2b-256 |
14d366f7709ae368069716fe2bfa754d5d4f3fc25f2c2e718ff1b5dd7bcfb425
|