python library that makes it easy to convert Excel tables into ORM-like objects
Project description
XLEA
xlea is a python library that makes it easy to convert Excel tables into ORM-like objects.
The library focised on schema-driven parsing of tabular data, where column resolution, validation and type conversion are handled explicitly and predictably.
⚠️ XLEAA is a work in progress. The public API is stabilizing, and core concepts are already in place.
Features
-
Declarative schema definition Describe tabular data using Python classes with type annotations and column descriptors.
-
Automatic column resolution Columns are matched by name, regular expression, or custom predicate — no hard-coded indexes.
-
Type-driven value conversion Cell values are automatically cast using schema type annotations with explicit error reporting.
-
Header-aware parsing Support for multi-row headers and complex header layouts via schema configuration.
-
Pluggable provider architecture File formats are handled by interchangeable providers, selected automatically by file extension.
-
Excel formats out of the box Native support for .xlsx, .xls, and .xlsb via dedicated providers.
-
Row-level validation Custom validators can be attached to columns to enforce domain-specific constraints.
-
Graceful handling of invalid data Optionally skip rows with invalid values instead of failing the entire read.
Example
Defining a Schema
from typing import Optional
from xlea import Schema, Column
age_name = lambda name: name.startswith("Age")
age_validator = lambda val: val.isnumeric()
@config(header_rows=2)
class Person(Schema):
id: str = Column("ID")
fullname: str = Column("Profile;Last Name, First Name", ignore_case=True)
age: int = Column(age_name, validator=age_validator, skip_invalid_row=True)
city: Optional[str] = Column("City", required=False, default="Voronezh")
Reading an Excel file
import xlea
from xlea.providers.openpyxl import OpenPyXlProvider
from schemas import Person
def main():
persons = xlea.read(OpenPyXlProvider("test_data.xlsx"), schema=Person)
# or with automatic provider selection
persons = xlea.autoread("test_data.xlsx", schema=Person)
for p in persons:
print(p.id, p.fullname, p.age)
if __name__ == "__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xlea-1.0.0.tar.gz.
File metadata
- Download URL: xlea-1.0.0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
364a71630c282b8ccedabd793fc8b382d3bea59a1ec14ea1bb16d3548419efb0
|
|
| MD5 |
b84762ee3b6fd00badd674eb20577a1d
|
|
| BLAKE2b-256 |
c011b9fa12178d3bed26c91c29cd458ea6b2330acec4994d1a9f3f86aae17637
|
File details
Details for the file xlea-1.0.0-py3-none-any.whl.
File metadata
- Download URL: xlea-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5929d0074691da96fb20db0db5b8f5114c9a78225afe11bf219f334423376f69
|
|
| MD5 |
6ca70f4e3dd6f3008a1b0a870560a2c4
|
|
| BLAKE2b-256 |
9add529b28d368ca16a1a64877a3a6e2faa846d4b596e583cfe0d98761614dfb
|