Skip to main content

Tool to simply display information about the state of the code during its 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).

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:

https://framagit.org/robinechuca/context-verbose/-/raw/main/basic_example.png

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:

https://framagit.org/robinechuca/context-verbose/-/raw/main/exaustive_example.png

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

context-verbose-2.0.3.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

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

context_verbose-2.0.3-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file context-verbose-2.0.3.tar.gz.

File metadata

  • Download URL: context-verbose-2.0.3.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/26.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.49.0 importlib-metadata/4.0.1 keyring/18.0.1 rfc3986/1.4.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for context-verbose-2.0.3.tar.gz
Algorithm Hash digest
SHA256 c569f5a62c2452bc1c12b27cdb83c3e986bcc72075d72e962db2fcb62b161b7d
MD5 e79aedb58b71397e4b6b057d3ac7e29f
BLAKE2b-256 b9dd22cfaf6e30c3a987c3e1e560d0a3132d35ae6b77c7dcde860dff62e31704

See more details on using hashes here.

File details

Details for the file context_verbose-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: context_verbose-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/26.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.49.0 importlib-metadata/4.0.1 keyring/18.0.1 rfc3986/1.4.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for context_verbose-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bf31e78fd7ad544f6f0652fbddb94ba4969b4f74565919150071e1cca0dfc93b
MD5 a70dc7856e204600d7677b671ab5bb3a
BLAKE2b-256 7cf4cae8488669ea191243b637f4093246713b5e066d60555cbacc7b281ccdcd

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