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. 5000×6 mixed zh-en rows (make bench):

engine width calc median (ms) speedup (vs original) speedup (vs now)
python (original) pure Python 322 1.0x
python (now) pure Python 75 4.3x 1.0x
python + C width native C 27 11.9x 2.8x
column native C 17 18.9x 4.4x

The original row is the pre-optimization implementation (git a5ce114): per-cell wcswidth, per-character control normalization, and duplicated row formatting. Optimizations: batched width calculation via the native library, flattened single-call batch, and regex-based normalization.

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.4.8.tar.gz (423.7 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.4.8-py3-none-manylinux_2_26_x86_64.whl (70.4 kB view details)

Uploaded Python 3manylinux: glibc 2.26+ x86-64

printable-0.4.8-py3-none-manylinux_2_26_aarch64.whl (267.1 kB view details)

Uploaded Python 3manylinux: glibc 2.26+ ARM64

printable-0.4.8-py3-none-macosx_11_0_arm64.whl (63.5 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

printable-0.4.8-py3-none-macosx_10_9_x86_64.whl (66.0 kB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: printable-0.4.8.tar.gz
  • Upload date:
  • Size: 423.7 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.4.8.tar.gz
Algorithm Hash digest
SHA256 42f733a026e5d7802f493713de60cd33f5e5855ed8bef234c0be1d09e6933acd
MD5 5805e4fa08ac5001eb301d711d74acf9
BLAKE2b-256 2da01dfc65ce0d75f3754e33aa8f66b9ee02d5a49286683ffcb87ae7ea7b7dcf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: printable-0.4.8-py3-none-manylinux_2_26_x86_64.whl
  • Upload date:
  • Size: 70.4 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.4.8-py3-none-manylinux_2_26_x86_64.whl
Algorithm Hash digest
SHA256 4da456042ebf02f27b81ed9da93a75749ecda0b36987e5c18d9b4bb143d42789
MD5 82a379b38125e766acc3fc2f57552952
BLAKE2b-256 7662a2d585b046747fa812696f5d6218b5c450e95d86ff2b462a9fc318f5617e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: printable-0.4.8-py3-none-manylinux_2_26_aarch64.whl
  • Upload date:
  • Size: 267.1 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.4.8-py3-none-manylinux_2_26_aarch64.whl
Algorithm Hash digest
SHA256 94c4ddf4771d3ca94b997925d0385aa58bf7371753ad89a7d2fc9167b3f8dac6
MD5 72ecb1b1b705c2932cb056cffb1f45c1
BLAKE2b-256 85eb6eb99031d665546d09d9ecf4cfb64fa2fba902f399af235dd776ef24f4a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: printable-0.4.8-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 63.5 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.4.8-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3dab9fdc2d28cf2e7c503250c8d7b6c0602b00ba8ae25c96e8538428bd102583
MD5 a9cf89e0ab479a5fa33828f0b227e93d
BLAKE2b-256 50d61f767c0a80654eb9578c0e50e370987b39c825849b501985acf36bdf082b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: printable-0.4.8-py3-none-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 66.0 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.4.8-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dc66dd088cbfcab1edd9b9627090ddfb09e3aec7cdd07874df65914b4092af8b
MD5 995f7fffd878363c8a73c8f9a4f9ab07
BLAKE2b-256 8ba781326f885e526444be3fef493c06f7b6884447a959c9760b603531161adc

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.1

5 files

0.5.0

5 files

This release

0.4.8 This release

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