Skip to main content

A Python library that provides beautiful console output using Rich panels for enhanced debugging and data visualization.

Project description

Panel Print

A Python library that provides beautiful console output using Rich panels for enhanced debugging and data visualization.

Python Version License Version

Features

  • 🎨 Beautiful Output: Pretty print objects in elegant Rich panels
  • 📦 Easy to Use: Simple API with just one main function
  • 🔧 Customizable: Configurable max length for container abbreviation
  • 🚀 Fast: Built on top of the powerful Rich library
  • 🐍 Modern Python: Supports Python 3.10+

Installation

Install using pip:

pip install panel-print

Or using uv:

uv add panel-print

Quick Start

from panel_print import pp

# Pretty print any Python object
data = {
    "name": "John Doe", 
    "age": 30,
    "skills": ["Python", "JavaScript", "Go"],
    "address": {
        "street": "123 Main St",
        "city": "San Francisco",
        "state": "CA"
    }
}

pp(data)

Usage Examples

Basic Usage

from panel_print import pp

# Print simple values
pp("Hello, World!")
pp(42)
pp([1, 2, 3, 4, 5])

Multiple Objects

from panel_print import pp

# Print multiple objects at once
pp("User Info:", {"name": "Alice", "age": 25}, ["admin", "user"])

Custom Max Length

from panel_print import pp

# Control container abbreviation
long_list = list(range(100))
pp(long_list, max_length=10)  # Will abbreviate after 10 items

Complex Data Structures

from panel_print import pp

# Works great with nested data
config = {
    "database": {
        "host": "localhost",
        "port": 5432,
        "credentials": {
            "username": "admin",
            "password": "secret"
        }
    },
    "features": ["auth", "logging", "caching"],
    "debug": True
}

pp(config)

Integration with Rich

from panel_print import print, pprint

# Access Rich's print and pprint directly
print("This uses Rich's enhanced print")
pprint({"key": "value"})  # Rich's pretty print without panels

API Reference

pp(*objects, max_length=20)

Pretty print objects in a panel format.

Parameters:

  • *objects (Any): One or more objects to pretty print
  • max_length (int, optional): Maximum length of containers before abbreviating. Defaults to 20.

Returns:

  • None

Example:

pp(data, max_length=50)

Advanced Usage

Debugging Complex Objects

from panel_print import pp
import datetime

class User:
    def __init__(self, name, email):
        self.name = name
        self.email = email
        self.created_at = datetime.datetime.now()
    
    def __repr__(self):
        return f"User(name='{self.name}', email='{self.email}')"

user = User("Alice", "alice@example.com")
pp("Debug User Object:", user, user.__dict__)

Working with APIs

import requests
from panel_print import pp

response = requests.get("https://api.github.com/users/octocat")
pp("GitHub API Response:", response.json())

Requirements

  • Python 3.10 or higher
  • Rich >= 14.1.0

Development

Setting up Development Environment

  1. Clone the repository:
git clone https://github.com/yourusername/panel-print.git
cd panel-print
  1. Install dependencies using uv:
uv sync
  1. Run tests:
uv run pytest

Building the Package

uv build

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

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

Acknowledgments

  • Built with Rich - Python library for rich text and beautiful formatting
  • Inspired by the need for better debugging output in Python applications

Changelog

v0.1.1

  • Initial release
  • Basic panel printing functionality
  • Support for multiple objects
  • Configurable max length parameter

Made with ❤️ for the Python community

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

panel_print-0.1.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

panel_print-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file panel_print-0.1.1.tar.gz.

File metadata

  • Download URL: panel_print-0.1.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for panel_print-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3080dab5d290e030cb7474466eea51ff10002b94999dabe22dd67374e70e78db
MD5 b35dddd4284b940cd3785b42da786b27
BLAKE2b-256 a8678cd6a3b961f373609d42b6f9f2e377140138fd2e1f32acecf2ac55a371c9

See more details on using hashes here.

File details

Details for the file panel_print-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for panel_print-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e0231dd628c1962fa57aed78cecac8573b5a91a25891b17af7d64cd80240322d
MD5 85bdea34bc1f07d5274261bfc662f28d
BLAKE2b-256 3e45dfb93c4a13b0619d5a77e5fcec24508adc827ba496741920c2fad020f658

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