print_schema
Ever had a complex Python object and wanted to easily see its structure?
print_schema makes it super easy to display the structure of complex dictionaries, JSONs, lists, etc It differs from pprint in that this displays the structure rather than the object itself.
New: Use print_matrix to display a 2D array (list of lists) in the matrix form.
Installing
You can download this package from pip:
pip install print-schema
How to use this package
from print_schema import print_schema
my_dict = {"bts": {"members": 7,
"bias": "Kim Tae-hyung",
"albums": {"first": "Dark & Wild",
"peak_chart_position": {"Japan": 30, "Korea": 2},
"favorite_songs": ["Blood Sweat and Tears", "Boy with luv"]},
"more_members_alive_than_dead": True,
(2, 3): "a random tuple"},
"beatles": {"members": 4,
"bias": "George Harrisom",
"albums": {"first": "Please Please Me",
"peak_chart_position": {"UK": 1, "France": 5, "Germany": 5},
"favorite_songs": ["Eleanor Rigby", "While My Guitar Gently Weeps"]},
"more_members_alive_than_dead": False,
(4, 5): "another random tuple"}}
print_schema(my_dict, indent=3, dense=False)
Display a list of lists as a matrix
New in version 1.1
from print_schema import print_matrix
my_arr = [[11, 312, None, 2],
[93, -45, 10],
[-100.3, 8, 192, 5],
[55, 1.5, 854, 6]]
print_matrix(my_arr, index=True)
Author
- Surya Shekhar Chakraborty
License
This project is licensed under the MIT License - see the LICENSE file for details
Acknowledgments
This project started when I started looking for a native Python equivalent of PySpark/Scala's printSchema() and couldn't find any :)
Much thanks to my favorite after-hours colleague Puneet Jindal for all the help.
Metadata
Release files for print-schema 1.1.1
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 | |
|---|---|---|---|---|
| print_schema-1.1.1.tar.gz | 4.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| print_schema-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / print_schema-1.1.1.tar.gz
| Download URL | print_schema-1.1.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21a58e655ead429e6aca4f32ad24679b4934aa4456976f5a7aa9033fc188408c
|
|
BLAKE2b-256 checksum How to use checksums |
5e3372a180af272d8cfec698d6c13a5d4906a1ea6e585656f83eee0830c4e087
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0
|
Release files / print_schema-1.1.1-py3-none-any.whl
| Download URL | print_schema-1.1.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f89460b7745f7b233edc8edc4656732a8f7f2bb8c54ca3b86d6e9e8bff096ed
|
|
BLAKE2b-256 checksum How to use checksums |
9e3db30fbd2e2e778d8967059c7b4ff953b60201b000c4ff71ca22b7f0c0de23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0
|
Security for print-schema 1.1.1
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.