Skip to main content

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).

Metadata

Release files for printt 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for printt 0.1.2
File Size Uploaded
printt-0.1.2.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for printt 0.1.2
File Interpreter ABI Platform
printt-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / printt-0.1.2.tar.gz

Download URL printt-0.1.2.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ceb9734de8e201b9140aadf2fe72a781550a70b6faeab0e13edb2bd9cba1c586
BLAKE2b-256 checksum
How to use checksums
ba58bdb08b1e3dc954924847ecbd604158b48d0bb86161fda11c34c4dffb34d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.9 Linux/6.5.0-1018-azure

Release files / printt-0.1.2-py3-none-any.whl

Download URL printt-0.1.2-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0de87c413fc8de2741b9662e41de80ccba162edb3b66e55acd5f00b1dc60cec4
BLAKE2b-256 checksum
How to use checksums
38251f8802fd599a1b87063f33f4ed8a331900aa3c57b7f24727bad9fda93111
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.9 Linux/6.5.0-1018-azure

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page