PyPformat
Overview
PyPformat is a simple and highly customizable python pretty-formatting package designed as an alternative to the built-in pprint library - PyPformat uses a different, more natural formatting style and provides extensive personalization capabilities, including text colorizing or customized indentation marking, on top of the basic options like compact printing.
The example below demostrates the difference in the default outputs produced by the pprint and PyPformat libraries.
>>> from pprint import pprint
>>> import pformat as pf
>>>
>>> from collections import ChainMap, Counter, OrderedDict, UserDict, defaultdict
>>>
>>> mapping = {
... "key1": 1,
... "key2": OrderedDict({"key3": 3, "key4": 4}),
... "key5": defaultdict(
... str,
... {
... "key6": 6,
... "a_very_long_dictionary_key7": ChainMap(
... {"key10": [10, 11, 12, 13], "key8": 8, "key9": 9}
... ),
... "key11": Counter("Hello"),
... },
... ),
... "key12": UserDict({0: "a", 1: "b", 2: "c"}),
... }
>>>
>>> pprint(mapping)
{'key1': 1,
'key12': {0: 'a', 1: 'b', 2: 'c'},
'key2': OrderedDict({'key3': 3, 'key4': 4}),
'key5': defaultdict(<class 'str'>,
{'a_very_long_dictionary_key7': ChainMap({'key10': [10,
11,
12,
13],
'key8': 8,
'key9': 9}),
'key11': Counter({'l': 2, 'H': 1, 'e': 1, 'o': 1}),
'key6': 6})}
>>>
>>> formatter = pf.PrettyFormatter()
>>> print(formatter(mapping))
{
'key1': 1,
'key2': OrderedDict({
'key3': 3,
'key4': 4,
}),
'key5': defaultdict(<class 'str'>, {
'key6': 6,
'a_very_long_dictionary_key7': ChainMap({
'key10': [
10,
11,
12,
13,
],
'key8': 8,
'key9': 9,
}),
'key11': Counter({
'H': 1,
'e': 1,
'l': 2,
'o': 1,
}),
}),
'key12': {
0: 'a',
1: 'b',
2: 'c',
},
}
Installation
The PyPformat package can be installed via pip:
pip install pypformat
For Developers
The PyPformat - Dev notes document contains the information about project development, testing and formatting.
Licence
The PyPformat project is licenced under the MIT Licence, which can be inspected in the LICENCE file in the project's root directory.
Metadata
Release files for pypformat 1.2.4
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 |
|---|---|---|---|---|
| pypformat-1.2.4.tar.gz | 19.0 kB | Without provenance | Details for pypformat-1.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pypformat-1.2.4-py3-none-any.whl | Python 3 | none | any | Details for pypformat-1.2.4-py3-none-any.whl |
Total release size: 31.0 kB
Release files / pypformat-1.2.4.tar.gz
| Download URL | pypformat-1.2.4.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80226d4accb55e94504d6619536513f02c5dbcda4e89b264e013fa0d507a3a92
|
|
BLAKE2b-256 checksum How to use checksums |
d3eb1d61305968294b6609dc21087b645b818a1ba99e5821c50c26b251f02037
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.1
|
Release files / pypformat-1.2.4-py3-none-any.whl
| Download URL | pypformat-1.2.4-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d72f0f5de7b82d2ed4eff06f6d8e686e64685074f967c1d0be0439d6b3444e9
|
|
BLAKE2b-256 checksum How to use checksums |
4a2d9477b659856fac07370a44e2e267602cbcc4a412265b198a89a914e5134e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.1
|
Security for pypformat 1.2.4
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.