c o d e c h u · s p a r k
▁▂▃▄▅▆▇█▇▆▅▄▃▂▁▂▄▆█▆▄▂▁▃▅▇█▇▅▃▁▂▅█▅▂▁▄▇▄▁▂▆█▆▂▁▃▇▇▃▁
── one line. one glance. one truth about your data. ──
Unicode sparklines, mini bar charts, and 1-D heatmaps — pure text.
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.
Documentation
- API reference — every public symbol with signatures, examples, and edge-case tables.
- Recipes — sparkline windows, top-N bars, 1-D heatmaps, custom ramps, terminal-width downsampling.
- Migration guide — 0.1 → 0.2 (internal refactor, no API changes).
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.
Metadata
Release files for codechu-spark 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| codechu_spark-0.3.0.tar.gz | 11.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| codechu_spark-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.3 kB
Release files / codechu_spark-0.3.0.tar.gz
| Download URL | codechu_spark-0.3.0.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe28fb95a7a4d5a0bd073bac25a9c80b3932283ef65e2528479adcbced9c9f4a
|
|
BLAKE2b-256 checksum How to use checksums |
3f1c3609cd3c3b670ffa83a45936c3adecf50285a0bbed0ef1c0aa64c8c76e54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency logRelease files / codechu_spark-0.3.0-py3-none-any.whl
| Download URL | codechu_spark-0.3.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
14b298b9a5289295417e3ddd4c2b0e1d7b9a0e530f39e60f52d7286c62106c3d
|
|
BLAKE2b-256 checksum How to use checksums |
21db56cc661dbeee660cdbd0894cdb215a6bc0d2b79d726af5361ae1897e4fa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency log