Pydantic is a data validation library that uses type annotations to describe the structure and constraints of application data. It is particularly useful when accepting information from APIs, configuration files, databases and other sources where the incoming values cannot be assumed to have the correct types.
Models provide a convenient way to work with validated data as ordinary objects. Developers can define required and optional fields, defaults, nested structures and custom validation rules. Pydantic can convert compatible values automatically or enforce strict validation where implicit conversions would be undesirable.
The library combines a familiar model-based interface with high-performance validation and serialization. It integrates with web frameworks and other development tools that use Python type annotations, allowing data models to serve as a consistent description of the information an application expects.
This is free and open source software.
Key Features
- Define data models using type annotations and the BaseModel class.
- Validate nested models, collections, unions, enumerations, dates, URLs and other structured values.
- Control required fields, optional values, defaults, aliases and field constraints.
- Choose between strict validation and automatic conversion of compatible input values.
- Add custom field and model validators to enforce application-specific rules.
- Use TypeAdapter to validate types without creating a BaseModel subclass.
- Validate function arguments using the validate_call decorator.
- Integrate validation with standard dataclasses and TypedDict definitions.
- Serialize models into dictionaries or JSON, with configurable field inclusion and exclusion.
- Define custom serializers for fields and complete models.
- Generate JSON Schema from models and adapted types.
- Return structured validation errors identifying invalid fields and their locations.
Website: docs.pydantic.dev/latest
Support:
Developer: Pydantic Services Inc. and individual contributors
License: MIT License
Pydantic is written in Python. Learn Python with our recommended free books and free tutorials.
Related Software
| Python Data Validation | |
|---|---|
| Pydantic | Data validation using Python type hints |
| pandera | Framework for precision data testing |
| jsonschema | Implementation of JSON Schema for Python |
| Cerberus | Lightweight and extensible data validation library |
| schema | Library for validating Python data structures |
| GX | Validating, documenting, and profiling data |
| marshmallow | ORM/ODM/framework-agnostic library |
| Voluptuous | Python data validation library |
| Schematics | Combine types into structures, validate , and transform the shapes of data |
| Colander | Serialization / deserialization / validation library |
| Valideer | Lightweight data validation and adaptation Python library |
| OpenRefine | Desktop program for data cleanup and transformation |
| Soda Core | Data quality and data contract verification engine |
| OpenMetadata | Unified metadata platform |
| Elementary OSS | dbt-native data observability command-line tool |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |

