Cyberbrain aims to free programmers from debugging. It lets you:
Backtraces variable changes.
See every state of program execution, including variables' values
Debug loops with confidence.
Never spend hours stepping through a program, let Cyberbrain tell you what happened.
To install Cyberbrain:
pip install cyberbrain code --install-extension laike9m.cyberbrain
How to Use
Suppose you want to trace a function
foo, just decorate it with
from cyberbrain import trace # As of now, you can only have one @trace decorator in the whole program. # We may change this in version 2.0, see https://github.com/laike9m/Cyberbrain/discussions/73 @trace # Disable tracing with `@trace(disabled=True)` def foo(): ...
Cyberbrain keeps your workflow unchanged. You run a program (from vscode or command line, both work), and a new panel will be opened to visualize how your program executed.
The following gif demonstrates the workflow (click to view the full size image):
❗Note on use❗
- Cyberbrain may conflict with other debuggers. If you set breakpoints and use VSC's debugger, Cyberbrain may not function normally. Generally speaking, prefer "Run Without Debugging" (like shown in the gif).
- If you have multiple VS Code window opened, the trace graph will always be created in the first one. #72 is tracking this issue.
- When having multiple decorators, you should put
@traceas the innermost one.
@app.route("/") @trace def hello_world(): x = [1, 2, 3] return "Hello, World!"
Cyberbrain is new and under active development, bugs are expected. If you met any, please create an issue. At this point, you should NOT use Cyberbrain in production. We'll release 1.0 when it's ready for production.
Major features planned for future versions are listed below. It may change over time.
|1.0||Code & trace interaction (#7), API specification|
|2.0||Multi-frame tracing (👉 I need your feedback for this feature)|
|4.0||Fine-grained symbol tracing|
Visit the project's kanban to learn more about the current development schedule.