Cyberbrain: Python debugging, redefined.

Overview

Cyberbrain: Python debugging, redefined.

support-version PyPI implementation PyPI version shields.io Discord

Cyberbrain1(电子脑) aims to free programmers from debugging. It lets you:

  • Backtrace 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.

Read more about existing features, and roadmaps for features to come.

I gave a talk at PyCascades 2021 about Cyberbrain, watch it here.

Install

Cyberbrain consists of a Python library and various editor/IDE integrations. Currently it supports VS Code and Gitpod. See our plan on expanding the support.

To install Cyberbrain:

pip install cyberbrain
code --install-extension laike9m.cyberbrain

You can also install from PyPI , VS Code marketplace or Open VSX .

Or, you can try Cyberbrain online: Open in Gitpod

How to Use

Suppose you want to trace a function foo, just decorate it with @trace:

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):

usage

Read our documentation to learn more about Cyberbrain's features and limitations.

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 @trace as the innermost one.
    @app.route("/")
    @trace
    def hello_world():
        x = [1, 2, 3]
        return "Hello, World!"

Roadmaps

Updated 2020.11

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.

Version Features
1.0 Code & trace interaction (#7), API specification
2.0 Multi-frame tracing ( 👉 I need your feedback for this feature)
3.0 async support, remote debugging
4.0 Fine-grained symbol tracing
5.0 Multi-threading support

Visit the project's kanban to learn more about the current development schedule.

How does it compare to other tools?

PySnooper PySnooper and Cyberbrain share the same goal of reducing programmers' work while debugging, with a fundamental difference: Cyberbrain traces and shows the sources of each variable change, while PySnooper only logs them. The differences should be pretty obvious after you tried both.
Debug Visualizer Debug visualizer and Cyberbrain have different goals. Debug visualizer visualizes data structures, while Cyberbrain visualizes program execution (but also lets you inspect values).
Python Tutor Python Tutor is for education purposes, you can't use it to debug your own programs. It's a brilliant tool for its purpose and I do it like it very much.

Community

Interested in Contributing?

See the development guide. This project follows the all-contributors specification. Contributions of ANY kind welcome!

All Contributors

Thanks goes to these wonderful contributors


laixintao

📖 💵

yihong

💵 🤔

dingge2016

💵

Frost Ming

🐛 📖

林玮 (Jade Lin)

🐛 🤔

Alex Hall

🤔

inkuang

🐛

Siyuan Xu

🐛

Ram Rachum

🤔

foo bar

💵

Support

I'm almost working full time (besides my regular job) on Cyberbrain. This project is huge, complicated and will last for years, however it will reshape how people think and do debugging. That's why I need your support. Let's make it the best Python debugging tool 🤟 !

❤️ Sponsor on GitHub

1: The name of this project originates from Ghost in the Shell, quote:

Cyberization is the process whereby a normal brain is physically integrated with electronic components to produce an augmented organ referred to as a cyberbrain.

Owner
laike9m
Author of Cyberbrain and pdir2
laike9m
Hypothesis debugging with vscode

Hypothesis debugging with vscode

Oliver Mannion 0 Feb 09, 2022
Inject code into running Python processes

pyrasite Tools for injecting arbitrary code into running Python processes. homepage: http://pyrasite.com documentation: http://pyrasite.rtfd.org downl

Luke Macken 2.7k Jan 08, 2023
GDB plugin for streaming defmt messages over RTT from e.g. JLinkGDBServer

Defmt RTT plugin from GDB This small plugin runs defmt-print on the RTT stream produced by JLinkGDBServer, so that you can see the defmt logs in the G

Gaute Hope 1 Dec 30, 2021
Silky smooth profiling for Django

Silk Silk is a live profiling and inspection tool for the Django framework. Silk intercepts and stores HTTP requests and database queries before prese

Jazzband 3.7k Jan 01, 2023
Winpdb Reborn - A GPL Python Debugger, reborn from the unmaintained Winpdb

Note from Philippe Fremy The port of winpdb-reborn to Python 3 / WxPython 4 is unfortunately not working very well. So Winpdb for Python 3 does not re

Philippe F 84 Dec 22, 2022
Sampling profiler for Python programs

py-spy: Sampling profiler for Python programs py-spy is a sampling profiler for Python programs. It lets you visualize what your Python program is spe

Ben Frederickson 9.5k Jan 08, 2023
Integration of IPython pdb

IPython pdb Use ipdb exports functions to access the IPython debugger, which features tab completion, syntax highlighting, better tracebacks, better i

Godefroid Chapelle 1.7k Jan 07, 2023
Django package to log request values such as device, IP address, user CPU time, system CPU time, No of queries, SQL time, no of cache calls, missing, setting data cache calls for a particular URL with a basic UI.

django-web-profiler's documentation: Introduction: django-web-profiler is a django profiling tool which logs, stores debug toolbar statistics and also

MicroPyramid 77 Oct 29, 2022
VizTracer is a low-overhead logging/debugging/profiling tool that can trace and visualize your python code execution.

VizTracer is a low-overhead logging/debugging/profiling tool that can trace and visualize your python code execution.

2.8k Jan 08, 2023
Arghonaut is an interactive interpreter, visualizer, and debugger for Argh! and Aargh!

Arghonaut Arghonaut is an interactive interpreter, visualizer, and debugger for Argh! and Aargh!, which are Befunge-like esoteric programming language

Aaron Friesen 2 Dec 10, 2021
Middleware that Prints the number of DB queries to the runserver console.

Django Querycount Inspired by this post by David Szotten, this project gives you a middleware that prints DB query counts in Django's runserver consol

Brad Montgomery 332 Dec 23, 2022
A simple rubber duck debugger

Rubber Duck Debugger I found myself many times asking a question on StackOverflow or to one of my colleagues just for finding the solution simply by d

1 Nov 10, 2021
Visual profiler for Python

vprof vprof is a Python package providing rich and interactive visualizations for various Python program characteristics such as running time and memo

Nick Volynets 3.9k Jan 01, 2023
OpenCodeBlocks an open-source tool for modular visual programing in python

OpenCodeBlocks OpenCodeBlocks is an open-source tool for modular visual programing in python ! Although for now the tool is in Beta and features are c

Mathïs Fédérico 1.1k Jan 06, 2023
Voltron is an extensible debugger UI toolkit written in Python.

Voltron is an extensible debugger UI toolkit written in Python. It aims to improve the user experience of various debuggers (LLDB, GDB, VDB an

snare 5.9k Dec 30, 2022
EDB 以太坊单合约交易调试工具

EDB 以太坊单合约交易调试工具 Idea 在刷题的时候遇到一类JOP(Jump-Oriented-Programming)的题目,fuzz或者调试这类题目缺少简单易用的工具,由此开发了一个简单的调试工具EDB(The Ethereum Debugger),利用debug_traceTransact

16 May 21, 2022
Sentry is cross-platform application monitoring, with a focus on error reporting.

Users and logs provide clues. Sentry provides answers. What's Sentry? Sentry is a service that helps you monitor and fix crashes in realtime. The serv

Sentry 32.9k Dec 31, 2022
Run-time type checker for Python

This library provides run-time type checking for functions defined with PEP 484 argument (and return) type annotations. Four principal ways to do type

Alex Grönholm 1.1k Jan 05, 2023
Code2flow generates call graphs for dynamic programming language. Code2flow supports Python, Javascript, Ruby, and PHP.

Code2flow generates call graphs for dynamic programming language. Code2flow supports Python, Javascript, Ruby, and PHP.

Scott Rogowski 3k Jan 01, 2023
Dahua Console, access internal debug console and/or other researched functions in Dahua devices.

Dahua Console, access internal debug console and/or other researched functions in Dahua devices.

bashis 156 Dec 28, 2022