Skip to main content

Python library to improve console printing by adding context to your prints. It makes your console much cleaner, and you won't have to worry about making your prints beautiful.

Project description

Python library to improve console printing by adding context to your prints. It makes your console much cleaner, and you won't have to worry about making your prints beautiful.

Warning: This library is not maintained anymore and its implementation uses questionable python tricks. It is advised for anyone interested in continuing it to figure out a better implementation and to start over with an entirely new project. A fork with more some additional features and more maintenance efforts is available at https://pypi.org/project/context-verbose/

Installation:

pip install secprint

Basic usage example:

from secprint import SectionPrinter as Spt

Spt.enter_section('Main section', color='blue')
Spt.print('Text in main section')
for i in range(3):
    Spt.enter_section('Subsection {}'.format(i + 1))
    Spt.print('Text in subsection')
    Spt.print('Text in subsection')
    Spt.exit_section()
Spt.exit_section()

The above example will print the following:

alt text

Advanced usage example, using contexts and automatic line skips when exiting sections:

from secprint import SectionPrinter as Spt

Spt.set_automatic_skip(True)

with Spt("Main section", color="blue"):
    Spt.print('Text in main section')
    for i in range(3):
        with Spt(f"Subsection {i + 1}"):
            Spt.print('Text in subsection')
            Spt.print('Text in subsection')

The above example will print the following:

alt text

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

secprint-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

secprint-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file secprint-0.1.0.tar.gz.

File metadata

  • Download URL: secprint-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.10.0 CPython/3.10.10

File hashes

Hashes for secprint-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a0b555cf9d097ed65d2be935816d256d6188c976530b97f4c66416fd502ce9c5
MD5 dbadf33e7770f259f25a2de23d5aa98f
BLAKE2b-256 d1fea51f9b1df14710d8d05e59bf916ffce81ef37171d13067348e521843f959

See more details on using hashes here.

File details

Details for the file secprint-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: secprint-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.10.0 CPython/3.10.10

File hashes

Hashes for secprint-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8afd59830f025f29f5a05f7c3e07ba0247e7b6d2dd3a521a0ebd6ed8bec74522
MD5 8c02c57f45b78f039efce3c7af853a32
BLAKE2b-256 881c53de9836f0420500a658a358d2d9da41dbcde182a56d2d2fbad2dab72f77

See more details on using hashes here.

Supported by

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