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 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

printable-0.5.0.tar.gz (218.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

printable-0.5.0-py3-none-manylinux_2_26_x86_64.whl (65.1 kB view details)

Uploaded Python 3manylinux: glibc 2.26+ x86-64

printable-0.5.0-py3-none-manylinux_2_26_aarch64.whl (62.4 kB view details)

Uploaded Python 3manylinux: glibc 2.26+ ARM64

printable-0.5.0-py3-none-macosx_11_0_arm64.whl (62.9 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

printable-0.5.0-py3-none-macosx_10_9_x86_64.whl (65.5 kB view details)

Uploaded Python 3macOS 10.9+ x86-64

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

Hashes for printable-0.5.0.tar.gz
Algorithm Hash digest
SHA256 85161f3b009b8ce4bf5b98be6eb30b3f0f80ac931c15abcb1a5368a350d58816
MD5 a135891582bffadc61e992e40673f57f
BLAKE2b-256 6f9fee870403046a2f59cc091a9afe877aeb82a76071eb88dd4d6f144dcc3ea4

See more details on using hashes here.

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

Hashes for printable-0.5.0-py3-none-manylinux_2_26_x86_64.whl
Algorithm Hash digest
SHA256 fd912aea9f6e162e1c8c6e52635d515e4af21d6cfe7ef36161ee2810899c303f
MD5 e3e819e11e31af8cc8aa15a12f5be009
BLAKE2b-256 86cc369720f1b3bae4e3d94f747003b556c33c7f40b0aa8c0a2ebe6419de0770

See more details on using hashes here.

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

Hashes for printable-0.5.0-py3-none-manylinux_2_26_aarch64.whl
Algorithm Hash digest
SHA256 4e562101861b774d7017e908954074669e4df07a744de7e97369e4e1a5d7c5ed
MD5 c032caa4b17c23484c822489c440b43e
BLAKE2b-256 d6f6f1c31ac065d9968a8b6f3c20d08faa1fe756d987ac8b8a8fc52d62f0ef05

See more details on using hashes here.

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

Hashes for printable-0.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68b02d20965fe0a841437b841f1830048359db190d122cff32b5ab59798b7025
MD5 c9e52d9fdb7131c2dbcb1e0f791582ac
BLAKE2b-256 803c21ebc41da09d8829d8af189fcc03f1996c6c82cdd627f8426841198ed145

See more details on using hashes here.

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

Hashes for printable-0.5.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6aef3f94bd1c87fc6e2a716f22b61b9068254ac6b5af10b25357a6748ac6c0a5
MD5 90b71d2ed7aeb39d3c575689b5cb0926
BLAKE2b-256 4cc8ec8c2aba08c66d52b9fa14c073e2694df1d05cf70cf56913e0589ab92497

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.1

5 files

This release

0.5.0 This release

5 files

0.4.8

5 files

0.4.7

5 files

0.4.4

2 files

0.4.3

1 file

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.9

2 files

0.3.8

1 file

0.3.7

2 files

0.3.6

2 files

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.9

1 file

0.2.8

1 file

0.2.7

1 file

0.2.6

1 file

0.2.5

1 file

0.2.4

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

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