-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
13,969 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
site/ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
Oops, something went wrong.