Metadata-Version: 2.4
Name: powergrid
Version: 0.2.0
Summary: A high-performance lookup library for Transmission System Operators (TSOs)
Project-URL: Homepage, https://github.com/cameraink/powergrid
Project-URL: Repository, https://github.com/cameraink/powergrid
Author: Guillaume Dion
License: MIT License
        
        Copyright (c) 2025 cameraink
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Requires-Dist: jsonschema
Description-Content-Type: text/markdown

# PowerGrid - TSO Finder

[![PyPI Version](https://img.shields.io/pypi/v/powergrid.svg)](https://pypi.org/project/powergrid/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python Versions](https://img.shields.io/pypi/pyversions/powergrid.svg)](https://pypi.org/project/powergrid/)

PowerGrid is a **high-performance Python library** for looking up **Transmission System Operators (TSOs)** based on **ISO country-region codes**.

> **📝 Note:** This version currently supports **French region codes only**.  
> 🎯 **Contributors are welcome** to extend it to other countries!  

> **📝 Version 0.2.0:**
> - ✅ **Now returns full `Tso` objects** instead of just IDs.
> - ✅ **Uses a shared `constants.py` file** for managing data source paths.
> - ✅ **Case-insensitive searches for region codes & ENTSO-E codes.**

## 🚀 Features

✅ **Blazing-fast in-memory lookup**  
✅ **Search by**:
- **Region code** (ISO 3166-2)
- **TSO ID**
- **ENTSO-E Code**

✅ **Case-insensitive searches**  
✅ **Optimized for REST APIs and large-scale queries**

---

## 📦 Installation

### **Using PyPI**
PowerGrid is available on PyPI. Install it with:
```sh
uv pip install powergrid
```

## 🛠 API Reference

### TsoFinder

#### Initialize the Finder
```python
from tso_finder import TsoFinder
finder = TsoFinder()
```

#### Lookup by Region Code
```python
print(finder.by_region("FR-IDF"))  # Output: "TSO_FR_001"
```

#### Lookup by TSO ID
```python
print(finder.by_tsoid("TSO_FR_001"))  # Output: ["FR-IDF", "FR-ARA", ...]
```

#### Lookup by ENTSO-E Code
```python
print(finder.by_entsoe("10YFR-RTE------C"))  # Output: <Tso object for RTE>
```

## 🏗 Contributing
👥 We welcome contributions!
To contribute:

1. Fork the repo and create a branch.
2. Add your feature or fix a bug.
3. Submit a pull request.

## 📜 License
PowerGrid is MIT Licensed.
See the LICENSE file for details.

## 💡 Why Use PowerGrid?
- Fast: Precomputes mappings for instant lookups.
- Scalable: Can handle large-scale queries efficiently.
- Reliable: Designed for TSO data accuracy.

