semvec/pypi-packages huggingface dataset:
fast-rich 0.3.1
A drop-in replacement for Python Rich, powered by Rust for maximum performance
License: MIT
Requires Python: >=3.10
Keywords: terminal, console, rich, formatting, rust, fast

# fast_rich

**fast_rich** is a drop-in replacement for [Python Rich](https://github.com/Textualize/rich), powered by Rust for maximum performance.

## 🚀 Features

- **Drop-in replacement** - Just change your imports!
- **Rust-powered performance** - 10-60x faster than Python Rich
- **Identical API** - Same class names, method signatures, and behavior
- **Type hints** - Full type annotations for modern Python development

## 📦 Installation

```bash
pip install fast-rich
```

## ⚡ Quick Start

Simply change your imports:

```python
# Before (Python Rich)
from rich.console import Console
from rich.table import Table

# After (fast_rich - just change the import!)
from fast_rich.console import Console
from fast_rich.table import Table
```

Everything else stays the same:

```python
from fast_rich.console import Console
from fast_rich.table import Table

console = Console()

# Tables work exactly like Rich
table = Table(title="Star Wars Movies")
table.add_column("Title", style="cyan")
table.add_column("Year", style="magenta")
table.add_row("A New Hope", "1977")
table.add_row("The Empire Strikes Back", "1980")

console.print(table)
```

## 📚 Available Components

| Component | Status | Python Rich Equivalent |
| :--- | :---: | :--- |
| `Console` | ✅ | `rich.console.Console` |
| `Table` | ✅ | `rich.table.Table` |
| `Text` | ✅ | `rich.text.Text` |
| `Style` | ✅ | `rich.style.Style` |
| `Panel` | ✅ | `rich.panel.Panel` |
| `Rule` | ✅ | `rich.rule.Rule` |
| `Tree` | ✅ | `rich.tree.Tree` |
| `Progress` | ✅ | `rich.progress.Progress` |
| `Markdown` | ✅ | `rich.markdown.Markdown` |
| `Syntax` | ✅ | `rich.syntax.Syntax` |
| `Columns` | ✅ | `rich.columns.Columns` |
| `Traceback` | ✅ | `rich.traceback.Traceback` |
| `Live` | ✅ | `rich.live.Live` |
| `Layout` | ✅ | `rich.layout.Layout` |
| `Prompt` | ✅ | `rich.prompt.Prompt` |
| `Confirm` | ✅ | `rich.prompt.Confirm` |
| `inspect` | ✅ | `rich.inspect` |
| `print` | ✅ | `rich.print` |

## 🎯 Key Differences

While fast_rich aims for 100% API compatibility, there are minor differences:

1. **Rust backend** - Rendering is done in Rust, not Python
2. **Performance** - Significantly faster for large outputs
3. **Memory** - Lower memory footprint for complex renders

## 🧪 Testing

All components are tested for parity with Python Rich:

```bash
cd bindings/python
python -m pytest tests/ -v
```

## 📈 Performance

| Operation | Python Rich | fast_rich | Speedup |
| :--- | ---: | ---: | ---: |
| Table (1000 rows) | 150ms | 2.5ms | **60x** |
| Progress rendering | 45ms | 0.7ms | **64x** |
| Syntax highlighting | 200ms | 5ms | **40x** |

## 📄 License

MIT License - See [LICENSE](../LICENSE) for details.

## 🙏 Credits

- [Rich](https://github.com/Textualize/rich) by Will McGugan - The original inspiration
- [PyO3](https://pyo3.rs/) - Rust/Python bindings