Skip to content

falkben/json-to-pydantic

Repository files navigation

json-to-pydantic

JSON to pydantic generator

Screenshot

Page at falkben.github.io/json-to-pydantic/

About

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.

Developer Notes

Install

  1. Create virtual environment and activate:

    python -m venv .venv && source .venv/bin/activate

  2. Install package

    pip install -e . -r requirements.txt

    Or with optional dev dependencies:

    pip install -e ".[dev]" -r requirements.txt -r requirements_dev.txt

Dependencies

Dependencies are specified in pyproject.toml and managed with pip-tools.

  1. Install pip-tools (globally with pipx or in local virtual environment with pip)

  2. Generate lock files:

    pip-compile pyproject.toml --quiet && \
    pip-compile --extra=dev --output-file=requirements_dev.txt pyproject.toml --quiet

To upgrade a dependency, pass the --upgrade-package flag along with the name of the package, or to upgrade all packages, pass the --upgrade flag to the command.

More information at: https://github.com/jazzband/pip-tools/