Skip to main content

Dynamically generate pydantic models from JSON schema.

Project description

dydantic

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.3.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

dydantic-0.0.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dydantic-0.0.3.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.2 Darwin/23.4.0

File hashes

Hashes for dydantic-0.0.3.tar.gz
Algorithm Hash digest
SHA256 34991723c75bd0a152049e888678f3589276b76168c59cf03e32db3bd6c12f33
MD5 dbc187e34938e93befdb06d389d538d7
BLAKE2b-256 03c80c1504cbda2e30c9a5b3b6a1e4f0245176b2b84b80ee39a73ea39ec7f8bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dydantic-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.2 Darwin/23.4.0

File hashes

Hashes for dydantic-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7336315b334318df108b09d6116b54f92410b5e2bf7ab5384d5afa261fb69c9b
MD5 a5c007a94ec8a5b71f5000f967104650
BLAKE2b-256 bde842cd9bc4f406c2a127bc1978045d3d73e02ed91573b62547b4466217659a

See more details on using hashes here.

Supported by

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