# 📦 PyRoute  
[![PyPI version](https://badge.fury.io/py/pyroute.svg)](https://pypi.org/project/pyroute/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pyroute.svg)](https://pypi.org/project/pyroute/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

**PyRoute** is a lightweight module for routing within nested structures. It provides an immutable, hashable path type
that you can define, combine, and serialize. One of its use cases is pinpointing the location of a value inside deeply nested data
such as dictionaries, json, yaml, ..., in-memory objects, or key-value stores.

---

## ✨ Features  

| Feature | Description |
|---------|-------------|
| 🔑 **Immutable & Hashable** | Use `Route` safely as navigate paths or dict keys |
| 🧩 **Composable** | Extend with `/` or `+` operators |
| 📜 **Serializable** | Compact Base64URL `serialize()` / `deserialize()` |
| 🌀 **Pythonic API** | Supports iteration, slicing, equality, hashing |
| 👀 **Readable** | Human-friendly form like `<root><a><1><b>` |

---

## 📦 Installation

### A) PyPI
```bash
pip install pyroute -U
```

---

### B) Github
```bash
git clone https://github.com/moh-dehghan/pyroute.git
cd pyroute
pip install -e .
```

---

## 🚀 Quick Start  

```python
from pyroute import Route

# Create routes
r1 = Route(1, 2, "3")
r2 = Route("x") / "y" + "z"

# Combine
r3 = r1 + r2
print(r3)   # <root><1><2><3><x><y><z>

# Iterate
for seg in r3:
    print(seg)

# Serialize / Deserialize
serial = r3.serialize()
print("Serialized:", serial)

restored = Route.deserialize(serial)
print("Restored:", restored)
```

---

## License

This project is licensed under the MIT License – see the [LICENSE](LICENSE) file for details.