Skip to main content

craftable - Simple, elegant terminal tables using format strings

Project description

craftable — Simple terminal tables using format strings

Generate clean, flexible text tables in the terminal or in text files using a familiar, Python-native formatting approach. craftable focuses on attractive and predictable output, zero dependencies, a simple and elegant API, and fast rendering without requiring a full TUI library.

  • Small, zero-dependency API
  • Works with plain Python data (lists/rows)
  • Column definitions use Python’s format mini-language
  • Multiple built-in styles: no borders, box drawing, rounded, ASCII, Markdown
  • Supports wrapping, truncation, alignment, and auto-fill columns
  • Simple, but flexible and extensible to meet most any use case

Quick example

from craftable import get_table

data = [
    ["Alice", 147000, .035, "Engineer"],
    ["Bob", 88000, .0433, "Designer"],
]

print(get_table(
    data,
    header_row=["Name", "Salary", "Adj", "Title"],
    col_defs=["A","<$ (,)", ">.2%", "A"],
    table_width=50,
))

Output:

      Name     │   Salary  │  Adj  │    Title     
───────────────┼───────────┼───────┼──────────────
 Alice         │ $ 147,000 │ 3.50% │ Engineer     
 Bob           │ $  88,000 │ 4.33% │ Designer     

When to use craftable

Use craftable when you need reliable text tables in logs, CLIs, or scripts, and want the control of Python format specs without heavy UI tooling. If you need interactive widgets or color/styling, consider pairing with Rich — but for static tables, craftable is intentionally simple and fast.

Getting Started

Read the online documentation:

https://ptyork.github.io/craftable

Available as craftable in PyPI with zero additional dependencies, so you can install or add to your project using your favorite package manager.

pip

pip install craftable

poetry

poetry add craftable

uv

uv add craftable

Or if using uv pip:

uv pip install craftable

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

craftable-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

craftable-0.1.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file craftable-0.1.0.tar.gz.

File metadata

  • Download URL: craftable-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.24

File hashes

Hashes for craftable-0.1.0.tar.gz
Algorithm Hash digest
SHA256 460909c4348e6c74e0e43bfc38ffdc2c007f536ca4c9954211208240d4055723
MD5 174c4eb507a6add5df2c54d56004b63f
BLAKE2b-256 576aefa88109c3232835e2a23898c6a503dc13138b07472dbd6070afd725b2a1

See more details on using hashes here.

File details

Details for the file craftable-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: craftable-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.24

File hashes

Hashes for craftable-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef0675073b69a40721098b8a62b68079dfb7b9521fb63d7006fa5407286a45d7
MD5 0324c8c2bf89a7568a4e12a7e6ffa98e
BLAKE2b-256 cbbb5f957a853f6ea86d3f2597f29ef94b42315f1fe65a371117207386201cd7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page