Tool to simply display information about the state of the code during execution.
Project description
By adding only a few lines of code at strategic places in your program, you will get a nice console display that will let you know what stage your code is at.
fork of context-printer:
This project is a fork of the context_printer project. The philosophy of this project is strictly the same as the original project. Nevertheless, this project offers the following improvements:
Support for the with keyword (context manager).
Formatting of exceptions for better debugging.
Added decorator behavior.
Possibility to implicitly name a section.
More formatting possible (adding highlighting and flashing).
No conflicts between thread and process (clients send text to a single server).
Integrated timer for display the sections duration.
Basic usage example:
from context_verbose import printer as ctp
with ctp('Main Section', color='blue'):
ctp.print('Text in main section')
for i in range(3):
with ctp(f'Subsection {i}'):
ctp.print('Text in subsection')
ctp.print('Text in subsection')
The above example will print the following:
Exaustive example of usage:
from context_verbose import printer as ctp
@ctp
def decorated_func(x):
return x**x**x
def error_func():
with ctp('Section that will fail'):
return 1/0
ctp.print('we will enter the main section')
with ctp('Main Section', color='cyan'):
ctp.print('text in main section')
try:
with ctp('Subsection 1'):
for x in [1, 8]:
decorated_func(x)
error_func()
except ZeroDivisionError:
pass
with ctp('Subsection 2', color='magenta'):
ctp.print('text in bold', bold=True)
ctp.print('underlined text', underline=True)
ctp.print('blinking text', blink=True)
ctp.print('yellow text', color='yellow')
ctp.print('text highlighted in blue', bg='blue')
ctp.print('text in several ', end='')
ctp.print('parts', print_headers=False)
ctp.print('''text in several
lines''')
with ctp(color='green'):
ctp.print('this subsection is automatically named')
ctp.print('we are out of the main section')
The above example will print the following:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file context-verbose-2.1.5.tar.gz
.
File metadata
- Download URL: context-verbose-2.1.5.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b81d004d6fe955bef53fb212b24a413aec3ee2c52b7d92c64a36c3f4db447bd |
|
MD5 | 73425e70aa6eff9c659854e814c8796c |
|
BLAKE2b-256 | e9cabc2a5631673bbc65b730a4085d1e810de446bdabdd94d1a0bc961c4013b6 |
File details
Details for the file context_verbose-2.1.5-py3-none-any.whl
.
File metadata
- Download URL: context_verbose-2.1.5-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e742cee949fcdeb9d2afc577dc364479010c3fe9616a739588e4f709d84c1d2 |
|
MD5 | 589044d0d2f6219804d3f8050d023bdd |
|
BLAKE2b-256 | 8bd50c6bfa94047bee07fa36be9922bd42ebde096398cac3b8320e2a47433c1c |