A package containing a lot of useful utilities for Python developing and debugging.

Related tags

Debugging Toolsvpack
Overview

Vpack

Python Versions PyPI Versions Publish to PyPI

A package containing a lot of useful utilities for Python developing and debugging.

Features

  • Sigview: press Ctrl+C to print the current stack instead of exiting.
  • Breakpt: set always-on, at-time, on-error breakpoints conveniently.
  • Reload: reload modules by names.

Installation

pip install --upgrade vpack

Examples

Sigview

Sigview is a signal handler. It will print the current running information (e.g. file, lineno, code, stack) when Ctrl+C is pressed.

Sigview Demo

Enable sigview:

from vpack import sigview
sigview.enable()
# your code goes here

Now run your script and you will see the following output:

$ python examples/sigview_example.py
(vpack): Sigview enabled. Press ^C to see the current frame. Press ^C again to exit.
1
2
1

Press Ctrl+C to see the current frame, possible outputs:

| | main() | | | | File "examples/sigview_example.py", line 11, in main | | time.sleep(2) | +----------------------------------------------------------+ ">
^C(vpack): Current file:
examples/sigview_example.py:11 in main
(vpack): Current stask:
+----------------------------------------------------------+
| File "examples/sigview_example.py", line 14, in 
   
     |
|   main()                                                 |
|                                                          |
| File "examples/sigview_example.py", line 11, in main     |
|   time.sleep(2)                                          |
+----------------------------------------------------------+

   

Press Ctrl+C twice (in 0.5 seconds) to exit.

You can also use sigview.enable(openshell=True) to open a new shell when Ctrl+C is pressed.

See sigview_example.py and sigview_openshell_example.py.md for more details.

Breakpt

Breakpt is a convenient way to set breakpoints.

.at(n) will try to open an interactive IPython shell (or pdb) when this line has been executed n times. .onerror() will try to open a PDB shell when an Exception is raised.

You can use breakpt.enable() and breakpt.disable() to enable and disable breakpt.

from vpack import breakpt

for i in range(10):
    print(i)
    breakpt.at(8) # break at i = 7
    breakpt.at(5) # break at i = 4

for i in range(6):
    print(i)
    if i == 2: breakpt.disable() # disable breakpt
    if i == 4: breakpt.enable() # enable breakpt
    breakpt.always() # break at i = 0, 1, 4, 5

breakpt.onerror()
a = [1, 2, 3]
for i in range(5):
    print(a[i]) # will break at i = 3

See breakpt_example.py for more details.

Reload

Reload modules by names, see reload_example.py for more details.

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
Trace any Python program, anywhere!

lptrace lptrace is strace for Python programs. It lets you see in real-time what functions a Python program is running. It's particularly useful to de

Karim Hamidou 687 Nov 20, 2022
Never use print for debugging again

PySnooper - Never use print for debugging again PySnooper is a poor man's debugger. If you've used Bash, it's like set -x for Python, except it's fanc

Ram Rachum 15.5k Jan 01, 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
Visual Interaction with Code - A portable visual debugger for python

VIC Visual Interaction with Code A simple tool for debugging and interacting with running python code. This tool is designed to make it easy to inspec

Nathan Blank 1 Nov 16, 2021
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
Full-screen console debugger for Python

PuDB: a console-based visual debugger for Python Its goal is to provide all the niceties of modern GUI-based debuggers in a more lightweight and keybo

Andreas Klöckner 2.6k Jan 01, 2023
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
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
A package containing a lot of useful utilities for Python developing and debugging.

Vpack A package containing a lot of useful utilities for Python developing and debugging. Features Sigview: press Ctrl+C to print the current stack in

volltin 16 Aug 18, 2022
AryaBota: An app to teach Python coding via gradual programming and visual output

AryaBota An app to teach Python coding, that gradually allows students to transition from using commands similar to natural language, to more Pythonic

5 Feb 08, 2022
Parsing ELF and DWARF in Python

pyelftools pyelftools is a pure-Python library for parsing and analyzing ELF files and DWARF debugging information. See the User's guide for more deta

Eli Bendersky 1.6k Jan 04, 2023
The official code of LM-Debugger, an interactive tool for inspection and intervention in transformer-based language models.

LM-Debugger is an open-source interactive tool for inspection and intervention in transformer-based language models. This repository includes the code

Mor Geva 110 Dec 28, 2022
An improbable web debugger through WebSockets

wdb - Web Debugger Description wdb is a full featured web debugger based on a client-server architecture. The wdb server which is responsible of manag

Kozea 1.6k Dec 09, 2022
Little helper to run Steam apps under Proton with a GDB debugger

protongdb A small little helper for running games with Proton and debugging with GDB Requirements At least Python 3.5 protontricks pip package and its

Joshie 21 Nov 27, 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
Auto-detecting the n+1 queries problem in Python

nplusone nplusone is a library for detecting the n+1 queries problem in Python ORMs, including SQLAlchemy, Peewee, and the Django ORM. The Problem Man

Joshua Carp 837 Dec 29, 2022
Monitor Memory usage of Python code

Memory Profiler This is a python module for monitoring memory consumption of a process as well as line-by-line analysis of memory consumption for pyth

Fabian Pedregosa 80 Nov 18, 2022
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
pdb++, a drop-in replacement for pdb (the Python debugger)

pdb++, a drop-in replacement for pdb What is it? This module is an extension of the pdb module of the standard library. It is meant to be fully compat

1k Dec 24, 2022