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.

Coloring output

By default nezu output is monochrome. You can color output on terminals that support it. Instead of passing --nezu at execution, pass --nezu-color.

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
  • add classes parameter (so you can print only group of logs)
  • 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.2.0.tar.gz (4.5 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.2.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nezu-0.2.0.tar.gz
  • Upload date:
  • Size: 4.5 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.2.0.tar.gz
Algorithm Hash digest
SHA256 30c090f287437379bc42ab8de3543c19c13c699092ed70052e3421f4dc61c1f7
MD5 80ca4536a46af1bf8897a6292e12c522
BLAKE2b-256 854f0b827564ac21b76d87eaf9331e99239a3ec2ff0188042d216cbb88e12222

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nezu-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ce9b8924ede73c8b9e3779cfca9ae1ca268524f3a62d804825c1933135c6ef6
MD5 ed6d64bc1ed89fd2c8fb595234bb5258
BLAKE2b-256 21663dc0374c9203ea5a012f633ab42b250662064fde845406910826fe521063

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