Skip to main content

Elegant debuging module

Project description

Nezu

PyPI version License Dependencies

Elegant debugging module

Example

# file.py
from nezu import say

x = 13
say('x')
$ py file.py --nezu
@5      l  x:int  =>  13

How to install?

$ python -m pip install nezu

or

$ python -m poetry add nezu

How to use?

Basic usage

Inspect variable using say() function. Pass name of variable you want to inspect as str argument.

# file.py
from nezu import say

say('egg')          # works on simple variables
say('ham.spam')     # works on attributes
say('spam["spam"]') # works on keys and indexes
say('print')        # works on functions and build-ins

Output is hidden by default. If you want to display debug commands run your program with argument --nezu.

$ python file.py            # Nothing is displayed by this command
$ python file.py --nezu     # But everything is displayed by this command
@4      u  egg
@5      u  ham.spam
@6      u  spam["spam"]
@7      b  print:function  =>  Prints the values to a stream, or to sys...

How to interpret output?

@7      b  print:function  =>  Prints the values to a stream, or to sys...
 │      │  │     │             │
 │      │  │     │             └───────── Value of inspected variable
 │      │  │     └─────────────── Type of inspected variable.
 │      │  └───────────── Name of inspected variable.
 │      └──────── Scope of inspected variable.
 │				  l:local, g:global, b:build-in, u:undefined          
 └────── Line number of inspection.

Hiding output

Function say() can be can be hidden into deeper levels of debugging via hide parameter. Execution argument --nezu seeks only for says hidden at level 1. Now if you want to display more, you run your program with --nezu-seek integer argument. In example bellow only says hidden up to level 3 are displayed.

#file.py
from nezu import say

say('egg', hide=1)
say('ham', hide=2)
say('spam', hide=3)
say('bacon', hide=4)
say('lobster', hide=5)
$ python file.py --nezu-seek=3
@4      u  egg
@5      u  ham
@6      u  spam

TO DO

  • add class method support?
  • add coloring
  • indicate shadowing
  • write docstring for say
  • write tests for say
  • automate testing with Github actions?
  • automate deployment to PyPI with Github actions?
  • publish to Conda
  • test on different CPython versions
  • test on different Pypy
  • test on Anaconda
  • add badges
  • format files with blue
  • remove obsolete tests
  • gitignore .vscode, __pycache, dist
  • write proper documentation
    • How to interpret output
    • Explain arguments
      • Hiding
      • Notes
      • args
    • Note args
    • brag about being on pypy and and conda
  • make a helper function, that returns dictionary (so it's easier to assert and doesn't require --nezu)
    • write function
    • write docstring for it
    • write tests for it
    • document it in README
  • Write code of conduct
  • Write/generate TOC

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

nezu-0.1.4.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nezu-0.1.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file nezu-0.1.4.tar.gz.

File metadata

  • Download URL: nezu-0.1.4.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.7 Windows/10

File hashes

Hashes for nezu-0.1.4.tar.gz
Algorithm Hash digest
SHA256 102d3bcc0a434e6a6374905d3c7452a934884b555ef48267967ed25c2c2fc939
MD5 fc754162c41de949c5e4568899d8c3a2
BLAKE2b-256 77c9fe96aed1b35248654c715cee69a9c2f826c949c19eef64f261bdf8f66c80

See more details on using hashes here.

File details

Details for the file nezu-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: nezu-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.7 Windows/10

File hashes

Hashes for nezu-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ac8defa860a2cea59d475756e3a7627de81aa3f0a35ed364fecffca8a52da4fb
MD5 48a7abe8c22ecb255059c5d716f707ea
BLAKE2b-256 f886745ff3996c4c7daa5b6585f557be2526e9c44a0b3e6d262ae9a1cb32d1b8

See more details on using hashes here.

Supported by

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