Skip to content

Commit

Permalink
Welcome to Dydantic
Browse files Browse the repository at this point in the history
  • Loading branch information
hinthornw authored Apr 6, 2024
1 parent 4f74d3e commit b908287
Show file tree
Hide file tree
Showing 16 changed files with 13,969 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/deploy_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy SDK Docs

on:
push:
branches:
- master
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install deps
run: |
pip install poetry poethepoet
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12
cache: poetry
cache-dependency-path: "poetry.lock"

- name: Poetry install
run: |
poetry install --with docs
- name: Build site
working-directory: ./docs
run: poetry run mkdocs build

- name: Configure GitHub Pages
uses: actions/configure-pages@v4

- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/site/

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# dydantic

<p align="left">
<img src="./img/dydantic.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.
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
site/
Binary file added docs/.langchain.db
Binary file not shown.
7 changes: 7 additions & 0 deletions docs/css/mkdocstrings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* https://mkdocstrings.github.io/crystal/styling.html#recommended-styles */

/* Indent and distinguish sub-items */
div.doc-contents:not(.first) {
padding-left: 15px;
border-left: 4px solid rgba(230, 230, 230);
}
27 changes: 27 additions & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dydantic

[Dydantic](https://github.com/hinthornw/dydantic) is a Python library for dynamically generating [Pydantic](https://github.com/pydantic/pydantic) models from [JSON Schema](https://json-schema.org/). It provides a convenient way to create Pydantic models on-the-fly from general user-defined schemas.

<p align="center">
<img src="./static/img/brand/dydantic.svg" width="50%" alt="dyno">
</p>

## Reference

::: dydantic._utils
handler: python
options:
selection:
docstring_style: google
rendering:
heading_level: 3
show_root_toc_entry: false
members: - create_model_from_schema

## 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](https://github.com/hinthornw/dydantic)

## License

dydantic is open-source software licensed under the [MIT License](https://github.com/hinthornw/dydantic/blob/main/LICENSE).
Loading

0 comments on commit b908287

Please sign in to comment.