beautifulprint
Pretty print, but it's prettier than pretty print (because it's colorized!)
Run pip install printbeautifully
Beautifulprint is a light-weight python package that allows you to easily and simply print data in a nice format. It also has strong customisation using function decorators and theme objects.
Note: it does not yet support self-referencing dictionaries/tuples
Helpful links
Usage
- Print a builtin data structure:
from beautifulprint import bprint
bprint({
"key": "value",
"number_list": [1, 2, 3],
"it also supports tuples!": (True, None, False)
})
- Print multiple pieces of data:
from beautifulprint import bprint
bprint({
"key": "value",
"number_list": [1, 2, 3],
"it also supports tuples!": (True, None, False)
}, # Just use a comma!
["a", "b", "c", 123.456]
)
- Use a different theme:
from beautifulprint import bprint, themes
with themes.BLAND: # You use a with statement
bprint({
"key": "value",
"number_list": [1, 2, 3],
"it also supports tuples!": (True, None, False)
})
- Or make your own theme:
from beautifulprint import bprint, Theme, pepr, rgb, RESET
my_theme = Theme("my cool theme") # Name of theme. Just used for printing the theme object
@my_theme.packer(cls=dict) # This decorator registers this function to my_theme as a way to format/pack a dictionary
def pack_dict(value: dict) -> str:
# This method will only be passed a dict (because of the decorator above) and must return a string
ret = 'dict('
for key, value in value.items():
# You use pepr, which will handle formatting child objects.
# You handle coloring in here as well, with the rgb function. You can also you colorama if you want
ret += f"{rgb(255, 0, 255)}{pepr(key)}{RESET} = {rgb(0, 255, 0)}{pepr(value, strip=True)}{RESET}, "
# The value item shouldn't be placed on a newline, so we strip the whitespace
ret += '\n)'
return ret
with my_theme: # You use a with statement
bprint({
"key": "value",
"number_list": [1, 2, 3],
"it also supports tuples!": (True, None, False)
})
Metadata
Release files for printbeautifully 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| printbeautifully-0.2.0.tar.gz | 7.6 kB | Without provenance | Details for printbeautifully-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| printbeautifully-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for printbeautifully-0.2.0-py3-none-any.whl |
Total release size: 16.6 kB
Release files / printbeautifully-0.2.0.tar.gz
| Download URL | printbeautifully-0.2.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62e044e95b964c5d784b52465feebdbfe41b64d50bc6925c403c2600f6e16195
|
|
BLAKE2b-256 checksum How to use checksums |
10d2ebfc79077a28a240a9bc122f8b1ccd19305a823d70b29f47053af384f53f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.21
|
Release files / printbeautifully-0.2.0-py3-none-any.whl
| Download URL | printbeautifully-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c86bc81b36b0cc401c922b866e330a88761b4781a8d34346ab61a38bf3f57b7
|
|
BLAKE2b-256 checksum How to use checksums |
64ae8890e03d5581a7da4d780bfb7df371e6ed66922d2d62018b7d4a35eba354
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.21
|
Security for printbeautifully 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.