Stdlib-only text visualizations — sparklines, mini bar charts, heatmaps.
Project description
codechu-spark
___ _ _
/ __\___ __| | ___ ___| |__ _ _
/ / / _ \ / _\` |/ _ \/ __| '_ \| | | |
/ /__| (_) | (_| | __/ (__| | | | |_| |
\____/\___/ \__,_|\___|\___|_| |_|\__,_|
Stdlib-only text visualizations — Unicode sparklines, labeled mini bar charts, 1D heatmaps — extracted from the Disk Cleaner toolchain. No external dependencies. Python 3.10+.
Install
pip install codechu-spark
API
sparkline(values, *, width=None, chars="▁▂▃▄▅▆▇█")
from codechu_spark import sparkline
sparkline([1, 3, 7, 2, 5]) # → '▁▃█▂▅'
sparkline(list(range(100)), width=10) # downsampled by averaging
sparkline([1, 2, 3], chars=".-=#") # custom glyphs
width=None→ one glyph per valuewidth<len(values)→ downsample by averaging consecutive bucketswidth>len(values)→ render atlen(values)(no upsampling)- Empty list →
''; all-equal → first glyph repeated
bar_chart(items, *, width=40, char="█")
from codechu_spark import bar_chart
print(bar_chart([
("python", 42),
("rust", 17),
("go", 8),
], width=20))
# python ████████████████████ 42
# rust ████████ 17
# go ███ 8
Bars are scaled to the maximum value. Labels are left-aligned to the longest label. Negative values clip to a zero-width bar.
heatmap(values, *, chars=" ░▒▓█")
from codechu_spark import heatmap
heatmap([0, 1, 2, 3, 4]) # → ' ░▒▓█'
heatmap([0, 5, 10], chars=".oO")
A denser-than-sparkline row. Useful for per-bucket load, hour-of-day utilization, or any single-row intensity readout.
Design
- Pure stdlib. Zero third-party dependencies.
- Single-row primitives. Each function returns a string (with
embedded newlines for
bar_chart); no terminal control codes, no cursor movement — that's a separate concern. - Custom glyphs welcome. Pass any
charsstring ordered low → high.
Tests
pip install -e ".[dev]"
pytest -q
Coverage gate: ≥90 %.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codechu_spark-0.1.0.tar.gz.
File metadata
- Download URL: codechu_spark-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44bb1436aed6f63545ced3eb220335729cf1efa6872d0c491b259431731e6b4a
|
|
| MD5 |
577fb486894c69086a42201cd7452385
|
|
| BLAKE2b-256 |
730ef5d4e316fcf00f48084ed9b86050343b2fce64557993ef7abd91aa90b307
|
Provenance
The following attestation bundles were made for codechu_spark-0.1.0.tar.gz:
Publisher:
release.yml on codechu/spark-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codechu_spark-0.1.0.tar.gz -
Subject digest:
44bb1436aed6f63545ced3eb220335729cf1efa6872d0c491b259431731e6b4a - Sigstore transparency entry: 1580200530
- Sigstore integration time:
-
Permalink:
codechu/spark-py@46b2c43e0ca8d084e0b468b1acf38cca0ea4baca -
Branch / Tag:
refs/heads/main - Owner: https://github.com/codechu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@46b2c43e0ca8d084e0b468b1acf38cca0ea4baca -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file codechu_spark-0.1.0-py3-none-any.whl.
File metadata
- Download URL: codechu_spark-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
092c0162ef4ec756576c49304f65bf5cfee5e367e0c5e8ab145cb2245f5b262f
|
|
| MD5 |
4e3b56bf6f28de37ee7b1baae13b0769
|
|
| BLAKE2b-256 |
c5dc41bbd3e88186ec69643275cf05b1305a0d38846b128bbcec9e635db5e119
|
Provenance
The following attestation bundles were made for codechu_spark-0.1.0-py3-none-any.whl:
Publisher:
release.yml on codechu/spark-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codechu_spark-0.1.0-py3-none-any.whl -
Subject digest:
092c0162ef4ec756576c49304f65bf5cfee5e367e0c5e8ab145cb2245f5b262f - Sigstore transparency entry: 1580200821
- Sigstore integration time:
-
Permalink:
codechu/spark-py@46b2c43e0ca8d084e0b468b1acf38cca0ea4baca -
Branch / Tag:
refs/heads/main - Owner: https://github.com/codechu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@46b2c43e0ca8d084e0b468b1acf38cca0ea4baca -
Trigger Event:
workflow_dispatch
-
Statement type: