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

Uploaded Python 3manylinux: glibc 2.26+ x86-64

printable-0.4.7-py3-none-manylinux_2_26_aarch64.whl (275.1 kB view details)

Uploaded Python 3manylinux: glibc 2.26+ ARM64

printable-0.4.7-py3-none-macosx_11_0_arm64.whl (71.5 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

printable-0.4.7-py3-none-macosx_10_9_x86_64.whl (74.0 kB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: printable-0.4.7.tar.gz
  • Upload date:
  • Size: 423.6 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.7.tar.gz
Algorithm Hash digest
SHA256 dab1d49f0b5018b79b3adb4c32b2b3ca9cd5e4f1ba34a84ac8589a3682859a36
MD5 15bc841c77a12bf8329c484900cacc29
BLAKE2b-256 84a6f465fb649ddb2b500d8c58ab9bc8e212ff0b32abbbd044bd484b545f035b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: printable-0.4.7-py3-none-manylinux_2_26_x86_64.whl
  • Upload date:
  • Size: 78.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.7-py3-none-manylinux_2_26_x86_64.whl
Algorithm Hash digest
SHA256 e4eb5227170d7b2f0d0ae81bcdba749c86f21bcbdccee4163f73bf8e59e220c5
MD5 8564e43727efb95a78ece963dc477491
BLAKE2b-256 b3fdce5f37dd62399e926211bcc839656db0bda4cc089a5f3df60557eaf75e12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: printable-0.4.7-py3-none-manylinux_2_26_aarch64.whl
  • Upload date:
  • Size: 275.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.7-py3-none-manylinux_2_26_aarch64.whl
Algorithm Hash digest
SHA256 ecb24c4ce6ccda28bdba52104f80cc0ecb8f0d67779555cc7f8a532cae8cb195
MD5 b80bc042fae8609c403337713f84f385
BLAKE2b-256 d9d90d57709e95774a60f56f91c55486d31c0bff9ac380b6cffba69488ee8414

See more details on using hashes here.

File details

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

File metadata

  • Download URL: printable-0.4.7-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 71.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.7-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b08b7a22d706549fc73f591979f75852efd7f6d50205abbe8d05fe5e033ad049
MD5 754550a3240f0f0d915150df9485ee96
BLAKE2b-256 e877afd6e278f885c3855d9aef875636dddb53a4f0341af6e0600ee86cd3d52b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: printable-0.4.7-py3-none-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 74.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.7-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b4f22a7032f4afcd2385b00e4966bcd3e11a3a43097b1e6019ebe9e2d3be0622
MD5 8d570d5b4a7f1d184787dd309dac0ef4
BLAKE2b-256 ad0adc9242790e1d5b98a7292101b7dd358bbbc54679302bc91d086e25329fb5

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.1

5 files

0.5.0

5 files

0.4.8

5 files

This release

0.4.7 This release

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