Gendalf is a code-first generator for Python adapters.
It generates type-safe transport and persistence layers directly from existing Python code and SQL files — without requiring OpenAPI, Protobuf, AsyncAPI, or ORMs.
Your code is the source of truth.
Gendalf generates the glue.
Key ideas
-
Code-first
- Adapters are generated from Python modules and SQL files
- No external specs to write or maintain
-
Deterministic
- Gendalf uses a deterministic, AST-based algorithm to analyze code and generate adapters
- It does not use LLMs or any probabilistic generation
- Given the same inputs, the output is always identical
-
Adapter-oriented
- Transport adapters: FastAPI servers, HTTP clients, gRPC, WebSockets
- Persistence adapters: SQL → typed Python APIs
- Boundary code only — business logic remains untouched
-
Type-safe
- Python types propagate across generated code
- SQL queries produce typed inputs and outputs
-
Minimal opt-in
- Use standard Python type annotations
- Mark Python classes intended as entrypoints with
@entrypoint - Add
-- sqlcastmarkers to SQL files - Everything else is inferred
Why Gendalf
Most code generators require you to:
- write specs first,
- duplicate models,
- adopt specific frameworks or ORMs.
LLM-based code generation introduces other problems:
- non-deterministic output,
- mandatory manual review,
- runtime cost and token usage.
Gendalf does the opposite:
- Python code defines the contract,
- SQL defines persistence,
- adapters and DTOs are generated by explicit algorithms (type inspection and AST traversal).
Generated code can be committed, regenerated in CI, and treated as compiler output.
Transports
FastAPI & HTTPX
Run with gendalf src cast fastapi.
Supported patterns:
- request-response (POST, JSON body)
- duplex streaming (WebSocket, JSON frames)
Generated code
src/api/fastapi/models.py— Pydantic request/response modelssrc/api/fastapi/client.py— async typed HTTP clientsrc/api/fastapi/server.py— server handlers with serialization and domain invocation
Generated code is complete and requires no manual edits.
Aiohttp
Run with gendalf src cast aiohttp.
Supported patterns:
- request-response (POST, JSON body)
- duplex streaming (WebSocket, JSON frames)
Generated code
src/api/aiohttp/models.pysrc/api/aiohttp/client.pysrc/api/aiohttp/server.py
Examples
gRPC (planned)
Not supported yet.
Planned:
- unary-unary
- unary-stream
- stream-unary
- stream-stream
Persistence
SQL
WIP: Generate type-safe Python APIs directly from SQL files — no ORM required.
Metadata
Release files for gendalf 0.4.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 | Actions |
|---|---|---|---|---|
| gendalf-0.4.0.tar.gz | 24.4 kB | With provenance | Details for gendalf-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gendalf-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for gendalf-0.4.0-py3-none-any.whl |
Total release size: 52.2 kB
Release files / gendalf-0.4.0.tar.gz
| Download URL | gendalf-0.4.0.tar.gz |
|---|---|
| Size | 24.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77fbb9d79260eb4ce4899513f92a4c7fe714d4053d5f0be32158df93201beaa4
|
|
BLAKE2b-256 checksum How to use checksums |
f22a3c41eca381ba6d6a89e56ed01c32d527b3b30662ecd83e2b05607a5822fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.
Transparency logRelease files / gendalf-0.4.0-py3-none-any.whl
| Download URL | gendalf-0.4.0-py3-none-any.whl |
|---|---|
| Size | 27.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e36586c7808a01b9f5f826364e0b0974ed77a667eaf0db453d9316716928b84c
|
|
BLAKE2b-256 checksum How to use checksums |
fc6a638522dba0aa35286bfa411a501f9944cf19c4a41c676d222aba0d6c0b1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.
Transparency logSecurity for gendalf 0.4.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for gendalf-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.