Skip to main content

craftable - craft elegant tables using format strings

Project description

craftable — craft elegant 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.post1.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.post1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: craftable-0.1.0.post1.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.post1.tar.gz
Algorithm Hash digest
SHA256 713f81a95519e9cc3aa5ea93b7aeedff8b83ba7d68e0f0e5d6e7673368e96120
MD5 a474c2beabbc334e877b504ffee7b978
BLAKE2b-256 a1e2a037a0c5b0cb2fd61be8f0bfb3d063ec6de9f1139215ab8a57c1ceb5af7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for craftable-0.1.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f78ef3c28d7a249073efc602d76ecac3ef38321a6612aa56cedc0b22415b9a9
MD5 bb92f20a39b52116b658e7d3f5b9b0b0
BLAKE2b-256 e829518db23ca01ae04eab184643fa6af5d70fc88403c745ee90ac8aba3a35f0

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