Metadata-Version: 2.5
Name: term-sparkline
Version: 0.1.0
Summary: Adaptive high-definition and text-based inline sparklines for modern terminals
Author: xchen17
License: MIT
License-File: LICENSE
Keywords: charts,cli,finance,iterm2,kitty,monitoring,sparkline,terminal
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Terminals
Requires-Python: >=3.9
Provides-Extra: all
Requires-Dist: pillow>=9.0.0; extra == 'all'
Provides-Extra: image
Requires-Dist: pillow>=9.0.0; extra == 'image'
Provides-Extra: test
Requires-Dist: pillow>=9.0.0; extra == 'test'
Requires-Dist: pytest>=7.0.0; extra == 'test'
Description-Content-Type: text/markdown

# 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 `Pillow` for 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

```bash
pip install term-sparkline[image]
```

*(Without `[image]`, it functions in pure-text Unicode Braille/Block mode with zero dependencies).*

---

## 🚀 Quick Start

### Python API

```python
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`

```python
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

```bash
# 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
