toolstr
toolstr makes it easy to create precise str representations of many different datatypes
toolstr has functionality for:
- formatting: convert numbers, timestamps, and bytecounts to str
- charting: create data charts using Unicode and other character sets
- tables: create highly-configurable table representations
toolstr uses many Unicode characters, but can also fallback to ascii when needed.
Install
pip install toolstr
Contents
Formatting
Charting
Tables
Each of the parameters shown below can be mixed and matched to achieve a particular style.
By default numbers in tables are converted to str using toolstr.format_number().
There are also some options visible in a terminal but not visible on github, including:
- color cells by column or by value
- separate color control of inner border vs outer border vs header border
- other rich styles including: bold, italic, and hyperlinks
Table Examples
toolstr.print_tables
{'add_row_index': True}
│ Name │ Era │ Age
─────┼────────────┼──────────────────────────┼─────────────────
1 │ Vaalbara │ Eoarchean-Mesoarchean │ 3,636,000,000
2 │ Gondwana │ Ediacaran-Jurassic │ 550,000,000
3 │ Pangea │ Carboniferous-Jurassic │ 336,000,000
{'border': 'thick'}
Name ┃ Era ┃ Age
━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━
Vaalbara ┃ Eoarchean-Mesoarchean ┃ 3,636,000,000
Gondwana ┃ Ediacaran-Jurassic ┃ 550,000,000
Pangea ┃ Carboniferous-Jurassic ┃ 336,000,000
{'border': 'double'}
Name ║ Era ║ Age
════════════╬══════════════════════════╬═════════════════
Vaalbara ║ Eoarchean-Mesoarchean ║ 3,636,000,000
Gondwana ║ Ediacaran-Jurassic ║ 550,000,000
Pangea ║ Carboniferous-Jurassic ║ 336,000,000
{'border': 'ascii'}
Name | Era | Age
------------+--------------------------+-----------------
Vaalbara | Eoarchean-Mesoarchean | 3,636,000,000
Gondwana | Ediacaran-Jurassic | 550,000,000
Pangea | Carboniferous-Jurassic | 336,000,000
{'outer_border': True}
┌────────────┬──────────────────────────┬─────────────────┐
│ Name │ Era │ Age │
├────────────┼──────────────────────────┼─────────────────┤
│ Vaalbara │ Eoarchean-Mesoarchean │ 3,636,000,000 │
│ Gondwana │ Ediacaran-Jurassic │ 550,000,000 │
│ Pangea │ Carboniferous-Jurassic │ 336,000,000 │
└────────────┴──────────────────────────┴─────────────────┘
{'outer_border': 'thick'}
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name │ Era │ Age ┃
┃────────────┼──────────────────────────┼─────────────────┃
┃ Vaalbara │ Eoarchean-Mesoarchean │ 3,636,000,000 ┃
┃ Gondwana │ Ediacaran-Jurassic │ 550,000,000 ┃
┃ Pangea │ Carboniferous-Jurassic │ 336,000,000 ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
{'header_location': 'bottom'}
Vaalbara │ Eoarchean-Mesoarchean │ 3,636,000,000
Gondwana │ Ediacaran-Jurassic │ 550,000,000
Pangea │ Carboniferous-Jurassic │ 336,000,000
────────────┼──────────────────────────┼─────────────────
Name │ Era │ Age
{'header_location': []}
Vaalbara │ Eoarchean-Mesoarchean │ 3,636,000,000
Gondwana │ Ediacaran-Jurassic │ 550,000,000
Pangea │ Carboniferous-Jurassic │ 336,000,000
{'header_location': ['top', 'bottom']}
Name │ Era │ Age
────────────┼──────────────────────────┼─────────────────
Vaalbara │ Eoarchean-Mesoarchean │ 3,636,000,000
Gondwana │ Ediacaran-Jurassic │ 550,000,000
Pangea │ Carboniferous-Jurassic │ 336,000,000
────────────┼──────────────────────────┼─────────────────
Name │ Era │ Age
{'separate_all_rows': True}
Name │ Era │ Age
────────────┼──────────────────────────┼─────────────────
Vaalbara │ Eoarchean-Mesoarchean │ 3,636,000,000
────────────┼──────────────────────────┼─────────────────
Gondwana │ Ediacaran-Jurassic │ 550,000,000
────────────┼──────────────────────────┼─────────────────
Pangea │ Carboniferous-Jurassic │ 336,000,000
{'compact': True}
Name Era Age
─────────────────────────────────────────────
Vaalbara Eoarchean-Mesoarchean 3,636,000,000
Gondwana Ediacaran-Jurassic 550,000,000
Pangea Carboniferous-Jurassic 336,000,000
{'header_border': 'thick'}
Name ┃ Era ┃ Age
━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━
Vaalbara │ Eoarchean-Mesoarchean │ 3,636,000,000
Gondwana │ Ediacaran-Jurassic │ 550,000,000
Pangea │ Carboniferous-Jurassic │ 336,000,000
{'header_style': 'bold'}
Name │ Era │ Age
────────────┼──────────────────────────┼─────────────────
Vaalbara │ Eoarchean-Mesoarchean │ 3,636,000,000
Gondwana │ Ediacaran-Jurassic │ 550,000,000
Pangea │ Carboniferous-Jurassic │ 336,000,000
FAQ
Metadata
Release files for toolstr 0.9.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| toolstr-0.9.12.tar.gz | 33.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| toolstr-0.9.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.5 kB
Release files / toolstr-0.9.12.tar.gz
| Download URL | toolstr-0.9.12.tar.gz |
|---|---|
| Size | 33.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c55bd4fa181280651b7a07bfd5e09e41d893de26ccd07ecbc9a38204b3b6dcc
|
|
BLAKE2b-256 checksum How to use checksums |
b4e947c61ab1e13f5c7e3f2e8953a30f58d8919ff469d7bb64e87859b9b04e9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Release files / toolstr-0.9.12-py3-none-any.whl
| Download URL | toolstr-0.9.12-py3-none-any.whl |
|---|---|
| Size | 41.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2878705180195b5667c1caea3e98c101ea9fbb828ac1b75f3907537efb3222bb
|
|
BLAKE2b-256 checksum How to use checksums |
3542bd14843ea982e42589d9068afb0bf5c01e4fd7ae6f466a8308ecda8aacca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Security for toolstr 0.9.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.