Skip to main content

Dynamically generate pydantic models from JSON schema.

Project description

dydantic

Documentation GitHub Repo

dyno

Dydantic is a Python library for dynamically generating Pydantic models from JSON schemas. It provides a convenient way to create Pydantic models on-the-fly based on the structure defined in a JSON schema.

Features

  • Automatically generate Pydantic models from JSON schemas
  • Support for nested objects and referenced definitions
  • Customizable model configurations, base classes, and validators
  • Handle various JSON schema types and formats
  • Extensible and flexible API

Installation

You can install dydantic using pip:

pip install -U dydantic

Usage

Here's a simple example of how to use dydantic to create a Pydantic model from a JSON schema:

from dydantic import create_model_from_schema

json_schema = {
    "title": "Person",
    "type": "object",
    "properties": {
        "name": {"type": "string"},
        "age": {"type": "integer"},
    },
    "required": ["name"],
}

Person = create_model_from_schema(json_schema)

person = Person(name="John", age=30)
print(person)  # Output: Person(name='John', age=30)

For more advanced usage and examples, please refer to the documentation.

Documentation

The complete documentation for dydantic can be found at: https://dydantic.readthedocs.io/

The documentation provides detailed information on installation, usage, API reference, and examples.

Contributing

Contributions to dydantic are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository: https://github.com/hinthornw/dydantic

Before contributing, please read our contributing guidelines for more information on how to get started.

License

dydantic is open-source software licensed under the MIT License.

Acknowledgments

We would like to express our gratitude to the following projects:

  • Pydantic - Dydantic builds upon the awesome Pydantic library, which provides the foundation for data validation and serialization.
  • JSON Schema - Dydantic leverages the JSON Schema specification to define the structure and constraints of the data models.
  • All the contributors who have helped improve dydantic with their valuable feedback, bug reports, and code contributions.

Thank you for using dydantic! If you have any questions or need assistance, please don't hesitate to reach out.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dydantic-0.0.8.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dydantic-0.0.8-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file dydantic-0.0.8.tar.gz.

File metadata

  • Download URL: dydantic-0.0.8.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.29

File hashes

Hashes for dydantic-0.0.8.tar.gz
Algorithm Hash digest
SHA256 14a31d4cdfce314ce3e69e8f8c7c46cbc26ce3ce4485de0832260386c612942f
MD5 afa7ed455e59ee150e1903550481a82f
BLAKE2b-256 08c52d097e5a4816b15186c1ae06c5cfe3c332e69a0f3556dc6cee2d370acf2a

See more details on using hashes here.

File details

Details for the file dydantic-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: dydantic-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.29

File hashes

Hashes for dydantic-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cd0a991f523bd8632699872f1c0c4278415dd04783e36adec5428defa0afb721
MD5 ba1ab8735966a65a87ba7a6c22b7afee
BLAKE2b-256 7a7ca1b120141a300853d82291faf0ba1a95133fa390e4b7d773647b69c8c0f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page