Skip to main content

Fast debugger for Python 3

Project description

FastDebugger

FastDebugger is a debugging tool for Python that allows users to quickly and easily print the values of variables in their code. To use FastDebugger, users simply call the fd() function and pass it the variables they want to print. FastDebugger will then print the variable name, value and other useful information. This can be helpful for quickly checking the values of variables and troubleshooting code.

GitHub release (latest by date) Working status Working Python version PyPI - License

Contents

Author

Installation

Install using pip

  pip install FastDebugger

  pip3 install FastDebugger

Call variables

fd(*args:Any, nl:bool=True)

The fd() call can take in any variables as arguments. It does not matter what type the variables are or how many there are. FastDebugger will print the type and value of each variable passed to it.

The nl parameter determines if a newline is printed after the fd() call.

Examples

Input:

from FastDebugger import fd

fd = FastDebugger()

lst = [123, True, 'Hello world!']

fd(lst, nl=True)
print('Foo')
fd(lst, nl=False) # Default value of `nl` is False
print('Foo')

Output:

fd |  list |  3  | lst
  |  int  |  0  | 123
  |  bool |  1  | True
  |  str  |  2  | 'Hello world!'

Foo
fd |  list |  3  | lst
  |  int  |  0  | 123
  |  bool |  1  | True
  |  str  |  2  | 'Hello world!'
Foo

How to use

Basic example

Input:

from FastDebugger import fd

def foo(x, y, z):
    result = x + y + z
    fd(x, y, z, result)

foo(1, 2, 3)

Output:

fd |  int  | x: 1
fd |  int  | y: 2
fd |  int  | z: 3
fd |  int  | result: 6

Output format:

fd | {variable type} | {variable name}: {variable value}

Lists, sets, tuples and dictionarys

Input:

from FastDebugger import fd
from random import randint

def bar(n):
    lst = [randint(0, n) for _ in range(n)]
    dct = {f'key_{i}': randint(0, n) for i in range(n)}
    tpl = tuple(randint(0, n) for _ in range(n))
    st = {randint(0, n) for _ in range(n)}

    fd(lst, st, tpl, dct, nl=True)

bar(5)

Output:

fd |  list |  5  | lst
  |  int  |  0  | 4
  |  int  |  1  | 5
  |  int  |  2  | 3
  |  int  |  3  | 5
  |  int  |  4  | 4

fd |  set  |  3  | st
  |  int  |  0  | 0
  |  int  |  1  | 2
  |  int  |  2  | 3

fd | tuple |  5  | tpl
  |  int  |  0  | 3
  |  int  |  1  | 5
  |  int  |  2  | 0
  |  int  |  3  | 3
  |  int  |  4  | 5

fd |  dict |  5  | dct
  |  int  |  0  | key_0: 0
  |  int  |  1  | key_1: 1
  |  int  |  2  | key_2: 1
  |  int  |  3  | key_3: 0
  |  int  |  4  | key_4: 3

Output format (list, set, tuple):

fd | {array type} | {array length} | {array name}
 ╚ | {variable type} | {index in array} | {variable value}

Output format (dictionary):

fd | dict | {dict length} | {dict name}
 ╚ | {value type} | {index in dict} | {key}: {value}

Numpy arrays

Input:

from FastDebugger import fd
import numpy as np

def bar(a, b):
    c = a * b
    d = np.sin(c)
    e = np.cos(d)
    f = np.tan(e)
    fd(a, b, c, d, e, f, nl=True)

bar(np.array([1, 2, 3]), np.array([4, 5, 6]))

Output:

fd | ndarray |  3  | a
  | int32 |  0  | 1
  | int32 |  1  | 2
  | int32 |  2  | 3

fd | ndarray |  3  | b
  | int32 |  0  | 4
  | int32 |  1  | 5
  | int32 |  2  | 6

fd | ndarray |  3  | c
  | int32 |  0  | 4
  | int32 |  1  | 10
  | int32 |  2  | 18

fd | ndarray |  3  | d
  | float64 |  0  | -0.7568024953079282
  | float64 |  1  | -0.5440211108893698
  | float64 |  2  | -0.7509872467716762

fd | ndarray |  3  | e
  | float64 |  0  | 0.7270351311688124
  | float64 |  1  | 0.8556343548213666
  | float64 |  2  | 0.7310155667453406

fd | ndarray |  3  | f
  | float64 |  0  | 0.8895922779758605
  | float64 |  1  | 1.1513517113559995
  | float64 |  2  | 0.8967481047747234

Output format (exactly like lists, sets...):

fd | {array type} | {array length} | {array name}
 ╚ | {variable type} | {index in array} | {variable value}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

FastDebugger-0.0.43.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

FastDebugger-0.0.43-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file FastDebugger-0.0.43.tar.gz.

File metadata

  • Download URL: FastDebugger-0.0.43.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for FastDebugger-0.0.43.tar.gz
Algorithm Hash digest
SHA256 3b001243bfabf61c736ad867fc67b3aba30a3e18e37a49e693ad090f1739fbef
MD5 a2cda4e4c1f6a791abafae9dc661169e
BLAKE2b-256 8e705a3637f6d7f05b328233855e0e9cc16701ccd098cb2393ee5efa615e01d4

See more details on using hashes here.

File details

Details for the file FastDebugger-0.0.43-py3-none-any.whl.

File metadata

File hashes

Hashes for FastDebugger-0.0.43-py3-none-any.whl
Algorithm Hash digest
SHA256 50a6ca9e2ddba20f119020334779ac79fbb3347209f9cf46c4cd571772b7da4d
MD5 63f9a62fde9dbee1ad5c5d67372dc65f
BLAKE2b-256 44d284eeb2116348808f2cd90912b4cdf91a84dd5fe21c564aabc9b21c3aa866

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page