Skip to main content

An enhanced print function for Python with advanced features.

Project description

Enhanced Print Library

Introduction

This library provides an enhanced eprint function for Python, offering a wide range of features to make your print statements more powerful, informative, and visually appealing. From basic styling and coloring to advanced debugging aids and structured data output, eprint aims to simplify your development and debugging workflows.

Features

eprint offers a comprehensive set of features, including but not limited to:

Basic Formatting

  • Colors: Apply foreground colors to your text (e.g., red, green, blue).
  • Background Colors: Set background colors for your text.
  • Styles: Apply text styles like bold, italic, underline, strikethrough, and reverse.

Layout and Presentation

  • Alignment: Align text to left, right, or center within a specified width.
  • Padding: Add padding around your text.
  • Borders: Enclose your text within single or double line borders.
  • Boxing: Create a simple box around your text.

Debugging and Contextual Information

  • Variable Name Display: Automatically print the name of the variable along with its value.
  • Expression Evaluation: Evaluate and display the result of a given expression.
  • Timestamp: Include a timestamp with each print statement.
  • Line Information: Show the filename and line number where eprint was called.
  • Function Name: Display the name of the function from which eprint was called.
  • Thread Information: Include the current thread's name and ID.
  • Process ID: Show the process ID.
  • Hostname: Display the hostname.
  • Username: Show the current username.
  • Application Name: Add a custom application name to the output.

Advanced Data Output

  • Pretty Printing: Format complex data structures (dictionaries, lists) for better readability.
  • Type Information: Display the data type of each argument.
  • JSON Formatting: Output data as a formatted JSON string.
  • XML Formatting: Output data as an XML string.
  • YAML Formatting: Output data as a YAML string.

Logging

  • File Logging: Redirect eprint output to a specified log file.
  • Log Levels: Assign different log levels (INFO, WARNING, ERROR, DEBUG, CRITICAL) to your messages.
  • Custom Log Formatters: Define custom formats for your log file output.

Installation

Currently, this library is not available on PyPI. You can install it by cloning the repository and installing it locally:

git clone [REPOSITORY_URL]
cd enhanced_print_lib
pip install .

Usage

To use the eprint function, simply import it from the enhanced_print module:

from enhanced_print.eprint import eprint

# Basic usage
eprint("Hello, World!")

# With colors and styles
eprint("This is a bold red message.", color="red", style="bold")

# With alignment and borders
eprint("Centered text with a border", align="center", width=50, border="double")

# Debugging variables
my_variable = 42
eprint(my_variable, var_name=True)

# Pretty printing a dictionary
my_dict = {"name": "Alice", "age": 30, "city": "New York"}
eprint(my_dict, pretty=True)

# Logging to a file
eprint("This message goes to the log file.", log_file="my_app.log", log_level="INFO")

For more detailed examples and a complete list of parameters, please refer to the source code and the example usage within eprint.py.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests on the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Manus AI

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

enhanced_print-0.1.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

enhanced_print-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: enhanced_print-0.1.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0rc1

File hashes

Hashes for enhanced_print-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b5b32ccd620ffe1cbacc068fb04fbced060efb0a4938107d8de6d983e6cfd258
MD5 972ab4bbc30500f98d38fb8e1d64fa43
BLAKE2b-256 17d0ce4b14eb843bedd78f24024961fd6c7b628c020f1456b1983e672241d46e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: enhanced_print-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0rc1

File hashes

Hashes for enhanced_print-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abcc5560d23b1778707d1e73876fdc23e72d4c42bbb4182569acdf89b24c2280
MD5 c1fcc096ff43f500f48b6d9369781119
BLAKE2b-256 49a8a2060005a0933be17d270e611b2524708fed3ea27cb63013e5362d16d5d3

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