{"id":24785503,"url":"https://github.com/zerlok/gendalf","last_synced_at":"2026-03-08T02:13:28.630Z","repository":{"id":274709853,"uuid":"922217232","full_name":"zerlok/gendalf","owner":"zerlok","description":"Code-first, deterministic generator for type-safe Python transport and SQL adapters.","archived":false,"fork":false,"pushed_at":"2025-12-21T18:32:18.000Z","size":573,"stargazers_count":2,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-23T06:45:29.351Z","etag":null,"topics":["adapter-pattern","aiohttp","ast","backend","code-first","codegen","compiler","deterministic","devtools","fastapi","grpc","no-ai","no-orm","python","sql","sql-codegen","static-analysis","type-safe"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerlok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-25T16:21:25.000Z","updated_at":"2025-12-21T18:20:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b34001c-4c0b-487b-a8f7-8cbf6fc3846e","html_url":"https://github.com/zerlok/gendalf","commit_stats":null,"previous_names":["zerlok/gendalf"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/zerlok/gendalf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerlok%2Fgendalf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerlok%2Fgendalf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerlok%2Fgendalf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerlok%2Fgendalf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerlok","download_url":"https://codeload.github.com/zerlok/gendalf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerlok%2Fgendalf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30242406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adapter-pattern","aiohttp","ast","backend","code-first","codegen","compiler","deterministic","devtools","fastapi","grpc","no-ai","no-orm","python","sql","sql-codegen","static-analysis","type-safe"],"created_at":"2025-01-29T14:18:45.303Z","updated_at":"2026-03-08T02:13:28.623Z","avatar_url":"https://github.com/zerlok.png","language":"Python","readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/zerlok/gendalf/main/docs/gendalf-logo.svg\" alt=\"Gendalf Logo\" width=\"600\"\u003e\n\n[![Latest Version](https://img.shields.io/pypi/v/gendalf.svg)](https://pypi.python.org/pypi/gendalf) [![Python Supported Versions](https://img.shields.io/pypi/pyversions/gendalf.svg)](https://pypi.python.org/pypi/gendalf) [![MyPy Strict](https://img.shields.io/badge/mypy-strict-blue)](https://mypy.readthedocs.io/en/stable/getting_started.html#strict-mode-and-configuration) [![Test Coverage](https://codecov.io/gh/zerlok/gendalf/branch/main/graph/badge.svg)](https://codecov.io/gh/zerlok/gendalf) [![Downloads](https://img.shields.io/pypi/dm/gendalf.svg)](https://pypistats.org/packages/gendalf) [![GitHub stars](https://img.shields.io/github/stars/zerlok/gendalf)](https://github.com/zerlok/gendalf/stargazers)\n\n*You shall pass... your code to adapters!*\n\u003c/div\u003e\n\n---\n\n**Gendalf** is a code-first generator for Python adapters.\n\nIt generates **type-safe transport and persistence layers** directly from existing Python code and SQL files —\nwithout requiring OpenAPI, Protobuf, AsyncAPI, or ORMs.\n\nYour code is the source of truth.  \nGendalf generates the glue.\n\n---\n\n# Key ideas\n\n* **Code-first**\n    * Adapters are generated from Python modules and SQL files\n    * No external specs to write or maintain\n\n* **Deterministic**\n    * Gendalf uses a deterministic, AST-based algorithm to analyze code and generate adapters\n    * It does not use LLMs or any probabilistic generation\n    * Given the same inputs, the output is always identical\n\n* **Adapter-oriented**\n    * Transport adapters: FastAPI servers, HTTP clients, gRPC, WebSockets\n    * Persistence adapters: SQL → typed Python APIs\n    * Boundary code only — business logic remains untouched\n\n* **Type-safe**\n    * Python types propagate across generated code\n    * SQL queries produce typed inputs and outputs\n\n* **Minimal opt-in**\n    * Use standard Python type annotations\n    * Mark Python classes intended as entrypoints with `@entrypoint`\n    * Add `-- sqlcast` markers to SQL files\n    * Everything else is inferred\n\n---\n\n# Why Gendalf\n\nMost code generators require you to:\n\n* write specs first,\n* duplicate models,\n* adopt specific frameworks or ORMs.\n\nLLM-based code generation introduces other problems:\n\n* non-deterministic output,\n* mandatory manual review,\n* runtime cost and token usage.\n\nGendalf does the opposite:\n\n* Python code defines the contract,\n* SQL defines persistence,\n* adapters and DTOs are generated by explicit algorithms\n  (type inspection and AST traversal).\n\nGenerated code can be committed, regenerated in CI, and treated as compiler output.\n\n---\n\n# Transports\n\n## FastAPI \u0026 HTTPX\n\nRun with `gendalf src cast fastapi`.\n\nSupported patterns:\n\n- request-response (POST, JSON body)\n- duplex streaming (WebSocket, JSON frames)\n\n### Generated code\n\n* `src/api/fastapi/models.py` — Pydantic request/response models\n* `src/api/fastapi/client.py` — async typed HTTP client\n* `src/api/fastapi/server.py` — server handlers with serialization and domain invocation\n\nGenerated code is complete and requires no manual edits.\n\n## Aiohttp\n\nRun with `gendalf src cast aiohttp`.\n\nSupported patterns:\n\n- request-response (POST, JSON body)\n- duplex streaming (WebSocket, JSON frames)\n\n### Generated code\n\n* `src/api/aiohttp/models.py`\n* `src/api/aiohttp/client.py`\n* `src/api/aiohttp/server.py`\n\n### Examples\n\n- [my greeter](https://raw.githubusercontent.com/zerlok/gendalf/main/examples/my_greeter)\n\n## gRPC (planned)\n\nNot supported yet.\n\nPlanned:\n\n- unary-unary\n- unary-stream\n- stream-unary\n- stream-stream\n\n---\n\n# Persistence\n\n## SQL\n\n**WIP:** Generate type-safe Python APIs directly from SQL files — no ORM required.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerlok%2Fgendalf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerlok%2Fgendalf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerlok%2Fgendalf/lists"}