Skip to main content

One-shot bootstrap generator for database models, API models, routes, and tests

Project description

Model Generator

A one-shot bootstrap code generator that turns JSON specifications into production-ready API backends — database models, API endpoints, tests, and migrations. The generator is stack-agnostic by design; it currently ships the python-fastapi stack (chosen with --stack, the default).

What It Does

  • Database models — SQLAlchemy ORM with constraints, relationships, and indexes
  • API models — Pydantic request/response schemas with validators
  • API routes — FastAPI CRUD endpoints
  • Tests — pytest contract tests with FactoryBoy factories (a full contract suite in the example project)
  • Migrations — Alembic infrastructure

Install

model-generator is a build-time scaffolding tool, not a runtime dependency of the backends it generates. Install it as an isolated global CLI:

uv tool install model-generator-kit     # or: pipx install model-generator-kit

This puts model-gen and model-val on your PATH. For the interactive wizard, add the extra: uv tool install "model-generator-kit[interactive]".

The PyPI package is model-generator-kit (the name model-generator was already taken); the commands it installs are model-gen and model-val.

Quick Start

# In any project directory, scaffold from your JSON specs
model-gen models/ --target all

model-gen --version    # confirm the install

To try the bundled example from a clone of this repo:

git clone https://github.com/nuncaeslupus/model-generator && cd model-generator
uv sync --extra dev
cd examples/user-auth-project
uv run model-gen models/ --target all
uv venv && uv sync --extra dev
uv run pytest  # the generated contract suite passes

For your own project, see the Installation Guide.

Documentation

For Users

For Agents

Deep Dives

For Contributors

Development

# Install in editable mode with dev dependencies
uv sync --extra dev

# Run the test suite
uv run pytest tests/ -v

Test Suite

File What It Covers
test_generators.py Each generator (database, API models, routes, tests, enums, constraints, infrastructure), immutable entities
test_edge_cases.py JSON comments, invalid input, config loading, deep merge, shared enums/constraints, file scanners, partial generation
test_wizard.py Wizard imports, prompt fallbacks, menu flow, project setup, clean and test runner actions
test_template_utils.py path_to_import, wrap_text, template environment, custom Jinja2 filters
test_cli.py CLI flags: --interactive, --clear-only, --dry-run, --diff, missing model
test_full_generation.py End-to-end generation from example project
test_integration.py Full generation pipeline
test_validation.py JSON schema validation
test_utils.py Utility functions

Philosophy

Define specifications once in JSON. Generate production-ready scaffolds. Then maintain and evolve manually. The generated code is yours — no lock-in, no regeneration, full control.


Model Generator | Bootstrap Tool for API Backends | v0.1.2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

model_generator_kit-0.1.2.tar.gz (153.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

model_generator_kit-0.1.2-py3-none-any.whl (129.7 kB view details)

Uploaded Python 3

File details

Details for the file model_generator_kit-0.1.2.tar.gz.

File metadata

  • Download URL: model_generator_kit-0.1.2.tar.gz
  • Upload date:
  • Size: 153.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for model_generator_kit-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ba04a4e532358bd1103428663b856bed2a820f5ec504ab4cb2c306cbfff49845
MD5 6d79a43957b2a52a5d6c80f0dccf6d35
BLAKE2b-256 18cb12ba93f98f54d8d86447a59543ce495e076f9a4bf09f9ad0a279396edc31

See more details on using hashes here.

Provenance

The following attestation bundles were made for model_generator_kit-0.1.2.tar.gz:

Publisher: release.yml on nuncaeslupus/model-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file model_generator_kit-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for model_generator_kit-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 af981b372d075e9f33a1508762af1c92f3b70a183fa813a5f31a9fdb7b809e9f
MD5 b55a2f74ff1304af3292ea4f3e46def8
BLAKE2b-256 47adb8d03144e6b2cf3a0ff5f2d684f83513334a17b29b00856d6df14697e9e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for model_generator_kit-0.1.2-py3-none-any.whl:

Publisher: release.yml on nuncaeslupus/model-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page