term-sparkline 📈
Adaptive high-definition (1px Retina) and Unicode-based inline sparklines for modern terminals.
Designed specifically for CLI tables, financial monitoring dashboards, and real-time metric trackers.
✨ Features
- Adaptive Terminal Detection: Automatically selects the best rendering protocol:
- iTerm2 / WezTerm / Ghostty: Renders ultra-fine, anti-aliased 1-pixel inline graphics directly in a single text row.
- Kitty: Uses Kitty graphics protocol.
- Fallback / Standard Terminals: Gracefully degrades to smooth Unicode Braille vector curves (
⡠⠤⠒⠊⠉) or classic Block bars (▂▃▅▇).
- Zero-Friction & Lightweight: Zero required dependencies (optional
Pillowfor inline images). - Table Friendly: Easily embeds into
Rich,Textual,tabulate, or raw terminal tables. - CLI Utility: Ready to use as a standalone command-line tool.
📦 Installation
pip install term-sparkline[image]
(Without [image], it functions in pure-text Unicode Braille/Block mode with zero dependencies).
🚀 Quick Start
Python API
from term_sparkline import sparkline
prices = [10.2, 10.3, 10.1, 10.5, 10.8, 10.7, 11.2, 11.0, 11.5]
# Auto-detects terminal and renders inline sparkline
chart = sparkline(prices, length=12, color=(235, 87, 87))
print(f"600519 贵州茅台 1680.50 +2.15% {chart}")
Integration with rich
from rich.table import Table
from rich.console import Console
from term_sparkline import sparkline
console = Console()
table = Table(title="Live Stock Watcher")
table.add_column("Symbol", justify="center")
table.add_column("Price", justify="right")
table.add_column("Change", justify="right")
table.add_column("Trend (Sparkline)", justify="left")
table.add_row("600519", "1680.50", "+2.15%", sparkline([10, 12, 11, 15, 18], color=(235, 87, 87)))
table.add_row("000001", "11.20", "-1.32%", sparkline([18, 16, 14, 12, 11], color=(46, 204, 113)))
console.print(table)
CLI Usage
# Pass numbers directly
sparkline 1 5 2 8 6 9 12 --red
# Or pipe from other tools
echo "10,12,11,15,18,22" | sparkline --green
📄 License
MIT
Metadata
Release files for term-sparkline 0.1.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 | Provenance | |
|---|---|---|---|---|
| term_sparkline-0.1.0.tar.gz | 6.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| term_sparkline-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.6 kB
Release files / term_sparkline-0.1.0.tar.gz
| Download URL | term_sparkline-0.1.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9518a43b780dbd93b31a7272273ddbe1e3dbf709bdc289145395b707a6047337
|
|
BLAKE2b-256 checksum How to use checksums |
59c49f3b434a78f2623ab008a8f50d455dfe0d25b04495cde3e37ac413212f02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0
|
Release files / term_sparkline-0.1.0-py3-none-any.whl
| Download URL | term_sparkline-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a4048c5ed0978bbb818b15c95d787438a9f7d8a2a9b9bdd02eff554898da2f6
|
|
BLAKE2b-256 checksum How to use checksums |
57f67faf5ad82e57cc08c79d1d582e3f60e1817ab58b351e2056f03258e7d35c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0
|
Security for term-sparkline 0.1.0
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.