Metadata-Version: 2.4
Name: serializable-excel
Version: 0.1.4
Summary: A user-friendly Python library for seamless bidirectional conversion between Excel spreadsheets and Pydantic models
Author: Dmitry Zaitsev
Maintainer: Dmitry Zaitsev
License: MIT License
        
        Copyright (c) 2025 Дмитрий Зайцев
        
        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.
        
Project-URL: Homepage, https://github.com/of1nn/serializable-excel
Project-URL: Documentation, https://of1nn.github.io/serializable-excel
Project-URL: Repository, https://github.com/of1nn/serializable-excel
Project-URL: Issues, https://github.com/of1nn/serializable-excel/issues
Keywords: excel,pydantic,serialization,data-validation,spreadsheet
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
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: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic<3.0.0,>=2.0.0
Requires-Dist: openpyxl>=3.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Dynamic: license-file

# SerializableExcel

[![Documentation](https://readthedocs.org/projects/serializableexcel/badge/?version=latest)](https://of1nn.github.io/serializable-excel)
[![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

A user-friendly Python library for seamless bidirectional conversion between Excel spreadsheets and Pydantic models using declarative syntax similar to SQLAlchemy.

## Quick Start

```python
from serializable_excel import ExcelModel, Column

class UserModel(ExcelModel):
    name: str = Column(header="Name")
    age: int = Column(header="Age")
    email: str = Column(header="Email")

# Read from Excel file
users = UserModel.from_excel("users.xlsx")

# Write to Excel file
UserModel.to_excel(users, "output.xlsx")

# Or work with bytes for API usage
excel_bytes = UserModel.to_excel(users, return_bytes=True)
users = UserModel.from_excel(file_bytes)
```

## Installation

```bash
pip install serializable-excel
```

Or install from source:

```bash
git clone https://github.com/of1nn/serializable-excel.git
cd serializable-excel
pip install -r requirements.txt
```

## Features

- **🔄 Bidirectional Conversion**: Seamlessly convert between Excel sheets and Pydantic models
- **📝 Declarative Syntax**: Define models using familiar SQLAlchemy-like syntax
- **🌐 API Ready**: Work with bytes/BytesIO for seamless web API integration (FastAPI, Flask, etc.)
- **🔍 Automatic Type Inference**: Smart type detection from Excel data
- **✅ Built-in Validation**: Automatic validation of data types and constraints
- **🔧 Dynamic Columns**: Support for runtime-detected columns perfect for admin-configurable fields
- **🛡️ Custom Validators**: Define validation functions for data integrity
- **📤 Custom Getters**: Extract values from complex database models when exporting
- **🎨 Cell Styling**: Conditional cell formatting with colors, fonts, and styles
- **📊 Column Ordering**: Control column order in exported Excel files with custom ordering functions

## Documentation

📚 **Full documentation is available at [of1nn.github.io/serializable-excel](https://of1nn.github.io/serializable-excel)**

The documentation includes:
- Installation guide
- Quick start tutorial
- API reference
- Advanced usage examples
- Dynamic columns guide
- Validation and getters documentation

## Requirements

- Python 3.8 or higher
- Pydantic 2.x
- openpyxl (for Excel file handling)

## License

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

## Contributing

Contributions are welcome! Please see our [Contributing Guide](https://of1nn.github.io/serializable-excel/contributing.html) for details.
