Skip to main content

easydatamodel - The easiest way to create type-safe dataclasses in Python

Just annotate your fields and you're good to go.

from easydatamodel import Model

class Person(Model):
    name: str
    age: int

Now you have a completely type-safe model that will validate your data for you, every time.

Person(name="John Doe", age=1)  # ✅ OK
Person(name="John Doe", age="timeless")  # ❌ InvalidModelError

# easydatamodel also validates new value assignments
person = Person(name="John Doe", age=1)
person.age = "is but a number" # ❌ raises a TypeError

Install

pip install easydatamodel

Requirements

  • Python 3.11+

easydatamodel vs. pydantic and dataclasses

Feature easydatamodel pydantic dataclasses
Validates data on instantiation ✅ ✅ ❌
Validates data on assignment ✅ Off by default ❌
ClassVar validation ✅ ❌ ❌
Automagic type coercion by default ❌ ✅ ❌

Should you use easydatamodel?

easydatamodel is perfect for simple, type-safe dataclasses with minimal effort and low overhead.

However, you should consider using pydantic if you need more advanced features.

easydatamodel as a meta-programming resource

Given the size of the easydatamodel codebase, easydatamodel is a fantastic resource for intermediate and advanced Python developers looking to learn how Python metaprogramming works.

This codebase demonstrates how only a few files of Python code can create a powerful library with an ergonomic syntax.

Metadata

Release files for easydatamodel 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easydatamodel 0.3.2
File Size Uploaded Provenance Actions
easydatamodel-0.3.2.tar.gz 10.7 kB Without provenance Details for easydatamodel-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for easydatamodel 0.3.2
File Interpreter ABI Platform Actions
easydatamodel-0.3.2-py3-none-any.whl Python 3 none any Details for easydatamodel-0.3.2-py3-none-any.whl

Total release size: 24.2 kB

Release files / easydatamodel-0.3.2.tar.gz

Download URL easydatamodel-0.3.2.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0f620c9ab39740f7e585db340978d2287ea116050cbeea44b5226c37afe7889f
BLAKE2b-256 checksum
How to use checksums
7d5ed0ac85f42971d79a11e7cab7e6826618a1c27a794d81bd7d408714927f38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.1 Darwin/23.5.0

Release files / easydatamodel-0.3.2-py3-none-any.whl

Download URL easydatamodel-0.3.2-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11f9d6ce4503aa2a182f569dc684a5eb575a893bc779a51f36432a855220fd26
BLAKE2b-256 checksum
How to use checksums
0c3073313dc7f37f3fb80e5acf2d6202c0d9e31615f7eaeab88226dd4068a826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.1 Darwin/23.5.0

Security for easydatamodel 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page