pydantic-generator
pydantic-generator generates a pydantic schema module from a json file.
install
pydantic-generates uses ast.unparse() and therefore only supports python 3.9+.
$ python3.9 -m pip install pydantic-generator
$ pydanticgen --help
usage: pydanticgen [-h] -i INPUT_ [-o OUTPUT]
optional arguments:
-h, --help show this help message and exit
-i INPUT_, --input_ INPUT_, --input INPUT_
-o OUTPUT, --output OUTPUT
example
$ ls
response.json
$ cat response.json
{
"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{
"value": "New",
"onclick": "CreateNewDoc()"
},
{
"value": "Open",
"onclick": "OpenDoc()"
},
{
"value": "Close",
"onclick": "CloseDoc()"
}
]
}
}
}
# this command generates Response.json
$ pydanticgen -i response.json
$ ls
response.json Response.py
$ cat Response.py
from pydantic import BaseModel
class Response(BaseModel):
class Menu(BaseModel):
id: str
value: str
class Popup(BaseModel):
class Menuitem(BaseModel):
value: str
onclick: str
menuitem: list[Menuitem]
popup: Popup
menu: Menu
(This sample can be found at https://json.org/example.html.)
Metadata
Release files for pydantic-generator 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pydantic-generator-1.0.0.tar.gz | 6.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydantic_generator-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.6 kB
Release files / pydantic-generator-1.0.0.tar.gz
| Download URL | pydantic-generator-1.0.0.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e9555748855c076588b27ca8bc71497545718fa9b76225578a81aaa903727ad
|
|
BLAKE2b-256 checksum How to use checksums |
fbb165fcb56fcd5f309d5a41bfa8028adf251c19a7e897966b4b9a34e970da61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Darwin/19.6.0
|
Release files / pydantic_generator-1.0.0-py3-none-any.whl
| Download URL | pydantic_generator-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57cace41c1db21d925bd1d704480710fa70a0905cc02797be76db29d840a5d36
|
|
BLAKE2b-256 checksum How to use checksums |
616978eb0e3ec8e43d1187e3b024f3c749b3de3d14f4fae67517fde42563374d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.0 Darwin/19.6.0
|
Security for pydantic-generator 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.