PrintDebug
A small debug printing module that prints extra info like filenames, function names, and line numbers. It can also recursively print objects such as lists, tuples, and dicts.
More useful stuff may be added in the future.
Example Usage:
Debug printing:
from printdebug import debug
def myfunction():
debug('Hello from myfunction.')
myfunction()
Output:
myfile.py: 3 myfunction(): Hello from myfunction.
Formatting:
The default format for line information is '{filename}:{lineno:>5} {name:>25}(): ', but can be set with the fmt arg:
debug('Test', fmt='#{lineno} in function {name}, file: {filename}')
The format can be set once, and used every time with a DebugPrinter instance, or by overriding printdebug.default_format:
from printdebug import DebugPrinter
dp = DebugPrinter(fmt='{filename}: {name}():#{lineno}')
dp.debug('Test')
There is a default colorized format, using the `colr <https://github.com/welbornprod/colr>`__ module.
from printdebug import DebugColrPrinter
dp = DebugColrPrinter()
dp.debug('Test')
Output:
printdebug.DebugColrPrinter
Print an object:
from printdebug import printobject
o = {'key1': {'subkey1': 'value1', 'subkey2': 'value2'}}
printobject(o)
Output:
key1:
subkey1:
value1
subkey2:
value2
Silencing debug prints:
debug() and DebugPrinter() can be silenced with debug_enable(False):
from printdebug import debug, debug_enable
debug('This will print.')
debug_enable(False)
debug('This will not.')
debug_enable()
debug('This will print now.')
Metadata
Release files for PrintDebug 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PrintDebug-0.3.5.tar.gz | 27.0 kB | Without provenance | Details for PrintDebug-0.3.5.tar.gz |
Release files / PrintDebug-0.3.5.tar.gz
| Download URL | PrintDebug-0.3.5.tar.gz |
|---|---|
| Size | 27.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d3b4e64162d611a51161ea08d06ed8c9a10b5697c3a63ccbe6f1baffcde52ab
|
|
BLAKE2b-256 checksum How to use checksums |
c5e92e68cbd0a32e679f3b4ca00e2fe212e6cc994513b6f409eecae0427eb587
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|
Security for PrintDebug 0.3.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.