JSON to pydantic generator
Page at falkben.github.io/json-to-pydantic/
Inspired by @brokenloop's jsontopydantic, this project implements the same conversion (using datamodel-code-generator), but does the conversion entirely in the browser, using PyScript & Pyodide.
-
Create virtual environment and activate:
uv venv -p 3.13 && source .venv/bin/activate -
Install package
uv pip install -e . -r requirements.txtOr with optional dev dependencies:
uv pip install -e ".[dev]" -r requirements.txt -r requirements_dev.txt
Dependencies are specified in pyproject.toml and managed with pip-tools.
Generate lock files and sync pyscript dependencies:
uv pip compile pyproject.toml --quiet --output-file=requirements.txt && \
uv pip compile --extra=dev --output-file=requirements_dev.txt pyproject.toml --constraint requirements.txt --quiet && \
python sync_pyscript_requirements.pyThe CI pipeline includes a check to ensure that pyscript.toml stays synchronized with requirements.txt. If you update dependencies, make sure to run the sync command above. The CI will fail if the PyScript configuration is out of sync.
You can manually check synchronization status with:
bash check_pyscript_sync.sh