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 current benchmark uses 5000×6 mixed zh-en rows on an Apple M4:
| engine | input | median (ms) | speedup |
|---|---|---|---|
| Python | rows | 78.96 | 1.00x |
| Python + C width | rows | 29.82 | 2.65x |
| Python column | str |
14.91 | 5.29x |
| Python column | bytes |
14.37 | 5.50x |
| Go column | []byte |
14.18 | 5.57x |
Python uses two warmups and ten repetitions; Go uses go test -bench with three runs. The Go 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% | | - | |
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file printable-0.5.0.tar.gz.
File metadata
- Download URL: printable-0.5.0.tar.gz
- Upload date:
- Size: 218.3 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85161f3b009b8ce4bf5b98be6eb30b3f0f80ac931c15abcb1a5368a350d58816
|
|
| MD5 |
a135891582bffadc61e992e40673f57f
|
|
| BLAKE2b-256 |
6f9fee870403046a2f59cc091a9afe877aeb82a76071eb88dd4d6f144dcc3ea4
|
File details
Details for the file printable-0.5.0-py3-none-manylinux_2_26_x86_64.whl.
File metadata
- Download URL: printable-0.5.0-py3-none-manylinux_2_26_x86_64.whl
- Upload date:
- Size: 65.1 kB
- Tags: Python 3, manylinux: glibc 2.26+ x86-64
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd912aea9f6e162e1c8c6e52635d515e4af21d6cfe7ef36161ee2810899c303f
|
|
| MD5 |
e3e819e11e31af8cc8aa15a12f5be009
|
|
| BLAKE2b-256 |
86cc369720f1b3bae4e3d94f747003b556c33c7f40b0aa8c0a2ebe6419de0770
|
File details
Details for the file printable-0.5.0-py3-none-manylinux_2_26_aarch64.whl.
File metadata
- Download URL: printable-0.5.0-py3-none-manylinux_2_26_aarch64.whl
- Upload date:
- Size: 62.4 kB
- Tags: Python 3, manylinux: glibc 2.26+ ARM64
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e562101861b774d7017e908954074669e4df07a744de7e97369e4e1a5d7c5ed
|
|
| MD5 |
c032caa4b17c23484c822489c440b43e
|
|
| BLAKE2b-256 |
d6f6f1c31ac065d9968a8b6f3c20d08faa1fe756d987ac8b8a8fc52d62f0ef05
|
File details
Details for the file printable-0.5.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: printable-0.5.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 62.9 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68b02d20965fe0a841437b841f1830048359db190d122cff32b5ab59798b7025
|
|
| MD5 |
c9e52d9fdb7131c2dbcb1e0f791582ac
|
|
| BLAKE2b-256 |
803c21ebc41da09d8829d8af189fcc03f1996c6c82cdd627f8426841198ed145
|
File details
Details for the file printable-0.5.0-py3-none-macosx_10_9_x86_64.whl.
File metadata
- Download URL: printable-0.5.0-py3-none-macosx_10_9_x86_64.whl
- Upload date:
- Size: 65.5 kB
- Tags: Python 3, macOS 10.9+ x86-64
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6aef3f94bd1c87fc6e2a716f22b61b9068254ac6b5af10b25357a6748ac6c0a5
|
|
| MD5 |
90b71d2ed7aeb39d3c575689b5cb0926
|
|
| BLAKE2b-256 |
4cc8ec8c2aba08c66d52b9fa14c073e2694df1d05cf70cf56913e0589ab92497
|