Skip to main content

No project description provided

Project description

Printt (Detailed print)

Description

This Python library, printt (printt), offers a convenient way to print detailed information about variables during development and debugging. It leverages the rich library for visually appealing output in your terminal.

Features

  • Variable Name Detection: Attempts to automatically identify the variable name using introspection.
  • Human-Readable Size Conversion: Converts raw byte sizes of variables into human-readable formats like KB, MB, GB, etc.
  • Customizable Printing: Control whether to print the actual variable value or a placeholder message using the print_variable flag.
  • Exception Handling: Gracefully handles potential exceptions during information retrieval, providing informative error messages.
  • Rich Formatting: Employs rich library for visually-appealing output in your terminal.

Installation

Install printt using Poetry:

poetry install printt

Usage

  1. Import:
from printt import printt
  1. Print Variable Details:
my_list = [1, 2, 3]
printt(my_list)

This will output details like variable name (if found), class type, size, and results of attempting to call type, dir, len, and a function to calculate memory usage.

Enabling/Disabling Printing

  • Enable printing:
from printt import enable_printt
enable_printt()
  • Disable printing:
from printt import disable_printt
disable_printt()

Additional Notes

  • The automatic variable name detection might not work in all cases.
  • Exception handling helps prevent unexpected errors while debugging.

Contributing

We welcome contributions to improve printt. Please feel free to submit pull requests!

License

This project is licensed under the terms of the MIT License (see LICENSE.md for details).

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

printt-0.1.2.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

printt-0.1.2-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

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