dydantic


Namedydantic JSON
Version 0.0.8 PyPI version JSON
download
home_pageNone
SummaryDynamically generate pydantic models from JSON schema.
upload_time2025-01-29 20:36:13
maintainerNone
docs_urlNone
authorWilliam Fu-Hinthorn
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # dydantic

[![Documentation](https://img.shields.io/badge/docs-hinthornw.github.io%2Fdydantic-blue)](https://hinthornw.github.io/dydantic/) [![GitHub Repo](https://img.shields.io/badge/GitHub-Repo-black?logo=github)](https://github.com/hinthornw/dydantic)

<p align="left">
  <img src="https://raw.githubusercontent.com/hinthornw/dydantic/main/docs/docs/static/img/dyno.svg" width="100" alt="dyno">
</p>


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:

```shell
pip install -U dydantic
```

## Usage

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

```python
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](CONTRIBUTING.md) for more information on how to get started.

## License

dydantic is open-source software licensed under the [MIT License](LICENSE).

## Acknowledgments

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

- [Pydantic](https://github.com/pydantic/pydantic) - Dydantic builds upon the awesome Pydantic library, which provides the foundation for data validation and serialization.
- [JSON Schema](https://json-schema.org/) - 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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dydantic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "William Fu-Hinthorn",
    "author_email": "13333726+hinthornw@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/08/c5/2d097e5a4816b15186c1ae06c5cfe3c332e69a0f3556dc6cee2d370acf2a/dydantic-0.0.8.tar.gz",
    "platform": null,
    "description": "# dydantic\n\n[![Documentation](https://img.shields.io/badge/docs-hinthornw.github.io%2Fdydantic-blue)](https://hinthornw.github.io/dydantic/) [![GitHub Repo](https://img.shields.io/badge/GitHub-Repo-black?logo=github)](https://github.com/hinthornw/dydantic)\n\n<p align=\"left\">\n  <img src=\"https://raw.githubusercontent.com/hinthornw/dydantic/main/docs/docs/static/img/dyno.svg\" width=\"100\" alt=\"dyno\">\n</p>\n\n\nDydantic 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.\n\n## Features\n\n- Automatically generate Pydantic models from JSON schemas\n- Support for nested objects and referenced definitions\n- Customizable model configurations, base classes, and validators\n- Handle various JSON schema types and formats\n- Extensible and flexible API\n\n## Installation\n\nYou can install dydantic using pip:\n\n```shell\npip install -U dydantic\n```\n\n## Usage\n\nHere's a simple example of how to use dydantic to create a Pydantic model from a JSON schema:\n\n```python\nfrom dydantic import create_model_from_schema\n\njson_schema = {\n    \"title\": \"Person\",\n    \"type\": \"object\",\n    \"properties\": {\n        \"name\": {\"type\": \"string\"},\n        \"age\": {\"type\": \"integer\"},\n    },\n    \"required\": [\"name\"],\n}\n\nPerson = create_model_from_schema(json_schema)\n\nperson = Person(name=\"John\", age=30)\nprint(person)  # Output: Person(name='John', age=30)\n```\n\nFor more advanced usage and examples, please refer to the documentation.\n\n## Documentation\n\nThe complete documentation for dydantic can be found at:\nhttps://dydantic.readthedocs.io/\n\nThe documentation provides detailed information on installation, usage, API reference, and examples.\n\n## Contributing\n\nContributions 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:\nhttps://github.com/hinthornw/dydantic\n\nBefore contributing, please read our [contributing guidelines](CONTRIBUTING.md) for more information on how to get started.\n\n## License\n\ndydantic is open-source software licensed under the [MIT License](LICENSE).\n\n## Acknowledgments\n\nWe would like to express our gratitude to the following projects:\n\n- [Pydantic](https://github.com/pydantic/pydantic) - Dydantic builds upon the awesome Pydantic library, which provides the foundation for data validation and serialization.\n- [JSON Schema](https://json-schema.org/) - Dydantic leverages the JSON Schema specification to define the structure and constraints of the data models.\n- All the contributors who have helped improve dydantic with their valuable feedback, bug reports, and code contributions.\n\nThank you for using dydantic! If you have any questions or need assistance, please don't hesitate to reach out.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Dynamically generate pydantic models from JSON schema.",
    "version": "0.0.8",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7a7ca1b120141a300853d82291faf0ba1a95133fa390e4b7d773647b69c8c0f4",
                "md5": "ba1ab8735966a65a87ba7a6c22b7afee",
                "sha256": "cd0a991f523bd8632699872f1c0c4278415dd04783e36adec5428defa0afb721"
            },
            "downloads": -1,
            "filename": "dydantic-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ba1ab8735966a65a87ba7a6c22b7afee",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 8637,
            "upload_time": "2025-01-29T20:36:12",
            "upload_time_iso_8601": "2025-01-29T20:36:12.217639Z",
            "url": "https://files.pythonhosted.org/packages/7a/7c/a1b120141a300853d82291faf0ba1a95133fa390e4b7d773647b69c8c0f4/dydantic-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "08c52d097e5a4816b15186c1ae06c5cfe3c332e69a0f3556dc6cee2d370acf2a",
                "md5": "afa7ed455e59ee150e1903550481a82f",
                "sha256": "14a31d4cdfce314ce3e69e8f8c7c46cbc26ce3ce4485de0832260386c612942f"
            },
            "downloads": -1,
            "filename": "dydantic-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "afa7ed455e59ee150e1903550481a82f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 8115,
            "upload_time": "2025-01-29T20:36:13",
            "upload_time_iso_8601": "2025-01-29T20:36:13.771545Z",
            "url": "https://files.pythonhosted.org/packages/08/c5/2d097e5a4816b15186c1ae06c5cfe3c332e69a0f3556dc6cee2d370acf2a/dydantic-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-29 20:36:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dydantic"
}
        
Elapsed time: 0.41061s