Library for beautiful object formatting
Project description
Beautiful-repr
Helps structure the formatting of objects in Python.
Installation
pip install beautiful-repr
Why Beautiful-repr ?
- Beautiful repr out of the box
- Great expansion possibilities
- Very small and simple
- No external dependencies
Example
from beautiful_repr import *
class ShoppingCart(StylizedMixin):
repr = BeautifulRepr([
Field("token"),
Field(
"products",
value_getter=parse_length,
formatter=TemplateFormatter("{value} products")
),
])
def __init__(self, token: str, products: tuple[str,] = tuple()):
self.token = token
self.products = tuple(products)
print(ShoppingCart("s12345", ("Potato", "iPhone", "New Vegas")))
output: ShoppingCart(token=s12345, 3 products)
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
beautiful_repr-0.0.2.tar.gz
(3.0 kB
view hashes)