Welcome to python-datamodel’s documentation!

PyPI GitHub Actions - CI GitHub Actions - pre-commit Codecov

DataModel

DataModel is a simple library based on python +3.7 to use Dataclass-syntax for interacting with Data, using the same syntax of Dataclass, users can write Python Objects and work with Data in the same way, is a reimplementation of python Dataclasses supporting true inheritance (without decorators), true composition and other good features.

The key features are: * Easy to use: No more using decorators, concerns abour re-ordering attributes or common problems with using dataclasses with inheritance.

Requirements

Python 3.7+

Installation

pip install python-datamodel

Usage

>>> from datamodel import Field, BaseModel
>>> @dataclass
>>> class Point:
>>>     x: int = Field(default=0, min=0, max=10)
>>>     y: int = Field(default=0, min=0, max=10)
>>>     c: float = Field(default=10, init=False)
>>> a = Point(x=10, y=10)

License

This project is licensed under the terms of the BSD v3. license.

Indices and tables