Skip to main content

Printable

CLI and functions help for printing tabular data.

Install

pip3 install printable

Rendering Engines

Two engines render tables: python (pure Python) and column (a ctypes binding of the compiled util-linux column command). By default (auto), the column engine is used when no --grid is set, and falls back to the python engine if the shared library is missing; grid styles always use the python engine. Select explicitly with -e python|column|auto.

Width calculation uses the native library when available and falls back to pure Python otherwise. The native width path has an ASCII fast path and batches all cells into one C call. The current benchmark uses 5000×6 mixed zh-en rows on an Apple M4:

engine input median (ms) speedup
Python rows 80.32 1.00x
Python + C width rows 28.37 2.83x
Python column str 14.62 5.49x
Python column bytes 14.51 5.53x
Go column []byte 14.10 5.70x

Python uses two warmups and ten repetitions; Go uses go test -bench with three runs. The standalone Python C-width call is 2.45 ms for the same 5000×6 cells; Go BenchmarkWidthsOf is 1.13 ms/op, 651–706 MB/s, with 17 allocations. The Go render benchmark reports about 811 KB and 5 allocations per render. The str/bytes difference is the Python UTF-8 input conversion cost; with pre-encoded input, both Go and Python spend most of the time in the shared C implementation.

Usage Example

from printable import readable

print(readable(list_of_dict, grid='full'))
$ printable -t csv -f samples/sample.csv
 symbol     desp      last    change   changeper  turnover  changesign  lastupdate
 HSI        恆指      26623   -468     1.73%      802億     -           2018/10/04 16:09
 HSCEI      國指      10547   -239     2.21%      257億     -           2018/10/04 16:08
 000001.SH  上證指數  2821    29       1.06%      1254億    +           2018/09/28 15:10
 000300.SH  滬深 300  3438    35       1.04%      949億     +           2018/09/28 15:10
 USDHKD     港匯      7.8337  -0.0037  -0.0472%             -

$ printable -t csv -f samples/sample.csv --grid inner
 symbol    │ desp     │ last   │ change  │ changeper │ turnover │ changesign │ lastupdate
───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────
 HSI       │ 恆指     │ 26623  │ -468    │ 1.73%     │ 802億    │ -          │ 2018/10/04 16:09
───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────
 HSCEI     │ 國指     │ 10547  │ -239    │ 2.21%     │ 257億    │ -          │ 2018/10/04 16:08
───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────
 000001.SH │ 上證指數 │ 2821   │ 29      │ 1.06%     │ 1254億   │ +          │ 2018/09/28 15:10
───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────
 000300.SH │ 滬深 300 │ 3438   │ 35      │ 1.04%     │ 949億    │ +          │ 2018/09/28 15:10
───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────
 USDHKD    │ 港匯     │ 7.8337 │ -0.0037 │ -0.0472%  │          │ -          │

$ printable -t csv -f samples/sample.csv --grid full
┌───────────┬──────────┬────────┬─────────┬───────────┬──────────┬────────────┬──────────────────┐
│ symbol    │ desp     │ last   │ change  │ changeper │ turnover │ changesign │ lastupdate       │
├───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────┤
│ HSI       │ 恆指     │ 26623  │ -468    │ 1.73%     │ 802億    │ -          │ 2018/10/04 16:09 │
├───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────┤
│ HSCEI     │ 國指     │ 10547  │ -239    │ 2.21%     │ 257億    │ -          │ 2018/10/04 16:08 │
├───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────┤
│ 000001.SH │ 上證指數 │ 2821   │ 29      │ 1.06%     │ 1254億   │ +          │ 2018/09/28 15:10 │
├───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────┤
│ 000300.SH │ 滬深 300 │ 3438   │ 35      │ 1.04%     │ 949億    │ +          │ 2018/09/28 15:10 │
├───────────┼──────────┼────────┼─────────┼───────────┼──────────┼────────────┼──────────────────┤
│ USDHKD    │ 港匯     │ 7.8337 │ -0.0037 │ -0.0472%  │          │ -          │                  │
└───────────┴──────────┴────────┴─────────┴───────────┴──────────┴────────────┴──────────────────┘

$ printable -t csv -f samples/sample.csv --grid markdown
| symbol    | desp     | last   | change  | changeper | turnover | changesign | lastupdate       |
|-----------|----------|--------|---------|-----------|----------|------------|------------------|
| HSI       | 恆指     | 26623  | -468    | 1.73%     | 802億    | -          | 2018/10/04 16:09 |
| HSCEI     | 國指     | 10547  | -239    | 2.21%     | 257億    | -          | 2018/10/04 16:08 |
| 000001.SH | 上證指數 | 2821   | 29      | 1.06%     | 1254億   | +          | 2018/09/28 15:10 |
| 000300.SH | 滬深 300 | 3438   | 35      | 1.04%     | 949億    | +          | 2018/09/28 15:10 |
| USDHKD    | 港匯     | 7.8337 | -0.0037 | -0.0472%  |          | -          |                  |

Metadata

Release files for printable 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for printable 0.5.1
File Size Uploaded Provenance
printable-0.5.1.tar.gz 218.4 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for printable 0.5.1
File
printable-0.5.1-py3-none-manylinux_2_26_x86_64.whl Python 3 none Linux glibc 2.26+ x86-64 Details
printable-0.5.1-py3-none-manylinux_2_26_aarch64.whl Python 3 none Linux glibc 2.26+ ARM64 Details
printable-0.5.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
printable-0.5.1-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details

Total release size: 474.8 kB

Release files / printable-0.5.1.tar.gz

Download URL printable-0.5.1.tar.gz
Size 218.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cc636b2e60bdf1683c81833400e2ad597a4778a10e33786e70e088315867863c
BLAKE2b-256 checksum
How to use checksums
33db8cead1a8be17d3d6e36f58c08d3d8af9d34f1eccf88adc51079f097838be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / printable-0.5.1-py3-none-manylinux_2_26_x86_64.whl

Download URL printable-0.5.1-py3-none-manylinux_2_26_x86_64.whl
Size 65.2 kB
Tags Linux glibc 2.26+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ac4900c4c2ea099fef88fe3363db8b9753bade39505afc4816d2e7fe1ab7a33e
BLAKE2b-256 checksum
How to use checksums
0637f5d788df9b71a48f2db3b6a4505128f47120da4c10a6bdd56be3fc12bc70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / printable-0.5.1-py3-none-manylinux_2_26_aarch64.whl

Download URL printable-0.5.1-py3-none-manylinux_2_26_aarch64.whl
Size 62.5 kB
Tags Linux glibc 2.26+ ARM64 Python 3
SHA-256 checksum
How to use checksums
623f457e15bd6eaa90e54e7664900b431df2d088b77a7df20e3829708d7bc902
BLAKE2b-256 checksum
How to use checksums
c52b2170c847077c29266a81c7303f2349427a9111882f1f8e6ec1cc4782bd2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / printable-0.5.1-py3-none-macosx_11_0_arm64.whl

Download URL printable-0.5.1-py3-none-macosx_11_0_arm64.whl
Size 63.0 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0c29386acadb9b3326e6d8d7a614a18ead63eb801eea6b7d9c3ad4ab191e4009
BLAKE2b-256 checksum
How to use checksums
d4118759b49fcc9e9edae6eb2e7389e972857f5190636301799aece786dc8591
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / printable-0.5.1-py3-none-macosx_10_9_x86_64.whl

Download URL printable-0.5.1-py3-none-macosx_10_9_x86_64.whl
Size 65.6 kB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
156244ffb3bc8b63499c6bdfdd55dba7018f8ceaf7609cd1048067be97b6df0a
BLAKE2b-256 checksum
How to use checksums
3f3ce70c64f9fe6d3d20b22311c3c69731d43dd11c6bf6231cd6c6dde5940c48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for printable 0.5.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.

Release history Release notifications | RSS feed

This release

0.5.1 This release

5 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page