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

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.1.tar.gz (218.4 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.1-py3-none-manylinux_2_26_x86_64.whl (65.2 kB view details)

Uploaded Python 3manylinux: glibc 2.26+ x86-64

printable-0.5.1-py3-none-manylinux_2_26_aarch64.whl (62.5 kB view details)

Uploaded Python 3manylinux: glibc 2.26+ ARM64

printable-0.5.1-py3-none-macosx_11_0_arm64.whl (63.0 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

printable-0.5.1-py3-none-macosx_10_9_x86_64.whl (65.6 kB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file printable-0.5.1.tar.gz.

File metadata

  • Download URL: printable-0.5.1.tar.gz
  • Upload date:
  • Size: 218.4 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.1.tar.gz
Algorithm Hash digest
SHA256 cc636b2e60bdf1683c81833400e2ad597a4778a10e33786e70e088315867863c
MD5 708bcffd53ddd3162181cdfa1bf9aefd
BLAKE2b-256 33db8cead1a8be17d3d6e36f58c08d3d8af9d34f1eccf88adc51079f097838be

See more details on using hashes here.

File details

Details for the file printable-0.5.1-py3-none-manylinux_2_26_x86_64.whl.

File metadata

  • Download URL: printable-0.5.1-py3-none-manylinux_2_26_x86_64.whl
  • Upload date:
  • Size: 65.2 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.1-py3-none-manylinux_2_26_x86_64.whl
Algorithm Hash digest
SHA256 ac4900c4c2ea099fef88fe3363db8b9753bade39505afc4816d2e7fe1ab7a33e
MD5 a31955adda680e79e68ff3c9e517a5a7
BLAKE2b-256 0637f5d788df9b71a48f2db3b6a4505128f47120da4c10a6bdd56be3fc12bc70

See more details on using hashes here.

File details

Details for the file printable-0.5.1-py3-none-manylinux_2_26_aarch64.whl.

File metadata

  • Download URL: printable-0.5.1-py3-none-manylinux_2_26_aarch64.whl
  • Upload date:
  • Size: 62.5 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.1-py3-none-manylinux_2_26_aarch64.whl
Algorithm Hash digest
SHA256 623f457e15bd6eaa90e54e7664900b431df2d088b77a7df20e3829708d7bc902
MD5 faabcbb81e53386ef88e345e3a985758
BLAKE2b-256 c52b2170c847077c29266a81c7303f2349427a9111882f1f8e6ec1cc4782bd2e

See more details on using hashes here.

File details

Details for the file printable-0.5.1-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: printable-0.5.1-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 63.0 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.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c29386acadb9b3326e6d8d7a614a18ead63eb801eea6b7d9c3ad4ab191e4009
MD5 24c03be27b1a9f5d778d13b1433bf379
BLAKE2b-256 d4118759b49fcc9e9edae6eb2e7389e972857f5190636301799aece786dc8591

See more details on using hashes here.

File details

Details for the file printable-0.5.1-py3-none-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: printable-0.5.1-py3-none-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 65.6 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.1-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 156244ffb3bc8b63499c6bdfdd55dba7018f8ceaf7609cd1048067be97b6df0a
MD5 7f530d09f6c94bebb7ae2a9f17ea0e12
BLAKE2b-256 3f3ce70c64f9fe6d3d20b22311c3c69731d43dd11c6bf6231cd6c6dde5940c48

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.1 This release

5 files

0.5.0

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