Name | gendalf JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | A Python codegen tool for transport layers in DDD, supporting most popular transport / API frameworks. |
upload_time | 2025-08-02 22:51:01 |
maintainer | None |
docs_url | None |
author | zerlok |
requires_python | <4.0,>=3.9 |
license | MIT |
keywords |
python
codegen
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Gendalf
[](https://pypi.python.org/pypi/gendalf)
[](https://pypi.python.org/pypi/gendalf)
[](https://mypy.readthedocs.io/en/stable/getting_started.html#strict-mode-and-configuration)
[](https://codecov.io/gh/zerlok/gendalf)
[](https://pypistats.org/packages/gendalf)
[](https://github.com/zerlok/gendalf/stargazers)
*You shall pass... your domain to transport!*
**Gendalf** is a Python code generation tool that simplifies the creation of **transport layer** code based on
**Domain-Driven Design (DDD)** principles. With **gendalf**, you can effortlessly generate FastAPI, HTTPX, gRPC,
aiohttp, and other transport framework code from your domain layer, ensuring that your business logic remains untouched
while automating the generation of transport-related code.
## Key Features
- **Domain-Driven Design (DDD) approach**: Keeps your business logic in the domain layer and generates the transport
layer automatically.
- **Multi-transport framework support**: Supports FastAPI and HTTPX (next in line: gRPC; and more frameworks planned for
future versions).
- **Powered by [astlab](https://github.com/zerlok/astlab) generator**: Uses Python's built-in Abstract Syntax Tree (AST)
to generate Python modules from your domain entities and interfaces.
## Why gendalf?
With **gendalf**, you don’t have to worry about manually wiring your domain logic to transport code. Whether you're
building APIs, microservices, or handling complex asynchronous communication, **gendalf** automates the transport layer
creation: handles repetitive and error-prone process of writing endpoint handlers and clients from scratch, letting you
focus on what matters most: your business logic.
### Target Audience
This tool is designed for Python developers working on services that follow the Domain-Driven Design (DDD) approach.
It's particularly useful for:
* Teams focusing on business logic without needing to handle the intricacies of APIs or transport layers.
* Developers building Python API services.
* Those looking for a way to streamline the development of API endpoints and client calls without the overhead of
boilerplate code.
### Comparison with existing codegen solutions
There are many tools for code generation in the Python ecosystem, but most are focused on simplifying specific tasks
like serialization, or generating CRUD / REST operations. Here’s how **gendalf** project differs:
* **Domain-Driven Design (DDD) Focus:** Unlike other code generation tools that focus on CRUD or specific transport
protocols, this project fully integrates with a DDD approach. This means developers work on the domain layer and let
the tool handle the presentation layer (API endpoints and clients).
* **Fully Automated Code Generation:** The generated code for the server and client is complete and doesn’t require
further modifications, saving time and reducing boilerplate.
* **Cross-Transport Flexibility:** Currently, it supports FastAPI and HTTPX, but future versions will add gRPC support,
allowing developers to generate code for various transport mechanisms without changing their domain logic.
E.g. `grpcio-tools` requires `.proto` files specification first and generates client stubs & server interface, so on the
server side an additional code is required: implement request deserialization from protobuf python classes to domain
(value objects), invoke domain layer and then serialize protobuf response.
## Transports & frameworks
### FastAPI & HTTPX
Run with `gendalf src cast fastapi`. It supports:
- request-response (POST method, request & response in HTTP body in JSON format)
- duplex streaming (WebSocket, requests & responses are in WS frames in JSON format)
#### What’s Generated
* `src/api/models.py`: Pydantic models for requests and responses that mirror the domain objects. Used by `client.py` and `server.py`
* `src/api/client.py`: Client classes with async methods, ready to make API calls with appropriate typings for request and
response data.
* `src/api/server.py`: Server handler classes, which include data serialization and domain logic invocation.
The generated code is complete, with no need for additional modifications.
#### Examples
- [my greeter](examples/my_greeter)
### gRPC (not supported yet)
**This framework support is not supported yet.**
- unary-unary
- stream-stream
- unary-stream
- stream-unary
Raw data
{
"_id": null,
"home_page": null,
"name": "gendalf",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "python, codegen",
"author": "zerlok",
"author_email": "danil.troshnev@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/5b/8bc561afa6fe1ed159c910da3d6a8559d9f6fd2e1de3aa6433116edef647/gendalf-0.2.0.tar.gz",
"platform": null,
"description": "# Gendalf\n\n[](https://pypi.python.org/pypi/gendalf)\n[](https://pypi.python.org/pypi/gendalf)\n[](https://mypy.readthedocs.io/en/stable/getting_started.html#strict-mode-and-configuration)\n[](https://codecov.io/gh/zerlok/gendalf)\n[](https://pypistats.org/packages/gendalf)\n[](https://github.com/zerlok/gendalf/stargazers)\n\n*You shall pass... your domain to transport!*\n\n**Gendalf** is a Python code generation tool that simplifies the creation of **transport layer** code based on\n**Domain-Driven Design (DDD)** principles. With **gendalf**, you can effortlessly generate FastAPI, HTTPX, gRPC,\naiohttp, and other transport framework code from your domain layer, ensuring that your business logic remains untouched\nwhile automating the generation of transport-related code.\n\n## Key Features\n\n- **Domain-Driven Design (DDD) approach**: Keeps your business logic in the domain layer and generates the transport\n layer automatically.\n- **Multi-transport framework support**: Supports FastAPI and HTTPX (next in line: gRPC; and more frameworks planned for\n future versions).\n- **Powered by [astlab](https://github.com/zerlok/astlab) generator**: Uses Python's built-in Abstract Syntax Tree (AST)\n to generate Python modules from your domain entities and interfaces.\n\n## Why gendalf?\n\nWith **gendalf**, you don\u2019t have to worry about manually wiring your domain logic to transport code. Whether you're\nbuilding APIs, microservices, or handling complex asynchronous communication, **gendalf** automates the transport layer\ncreation: handles repetitive and error-prone process of writing endpoint handlers and clients from scratch, letting you\nfocus on what matters most: your business logic.\n\n### Target Audience\n\nThis tool is designed for Python developers working on services that follow the Domain-Driven Design (DDD) approach.\nIt's particularly useful for:\n\n* Teams focusing on business logic without needing to handle the intricacies of APIs or transport layers.\n* Developers building Python API services.\n* Those looking for a way to streamline the development of API endpoints and client calls without the overhead of\n boilerplate code.\n\n### Comparison with existing codegen solutions\n\nThere are many tools for code generation in the Python ecosystem, but most are focused on simplifying specific tasks\nlike serialization, or generating CRUD / REST operations. Here\u2019s how **gendalf** project differs:\n\n* **Domain-Driven Design (DDD) Focus:** Unlike other code generation tools that focus on CRUD or specific transport\n protocols, this project fully integrates with a DDD approach. This means developers work on the domain layer and let\n the tool handle the presentation layer (API endpoints and clients).\n* **Fully Automated Code Generation:** The generated code for the server and client is complete and doesn\u2019t require\n further modifications, saving time and reducing boilerplate.\n* **Cross-Transport Flexibility:** Currently, it supports FastAPI and HTTPX, but future versions will add gRPC support,\n allowing developers to generate code for various transport mechanisms without changing their domain logic.\n\nE.g. `grpcio-tools` requires `.proto` files specification first and generates client stubs & server interface, so on the\nserver side an additional code is required: implement request deserialization from protobuf python classes to domain\n(value objects), invoke domain layer and then serialize protobuf response.\n\n## Transports & frameworks\n\n### FastAPI & HTTPX\n\nRun with `gendalf src cast fastapi`. It supports:\n\n- request-response (POST method, request & response in HTTP body in JSON format)\n- duplex streaming (WebSocket, requests & responses are in WS frames in JSON format)\n\n#### What\u2019s Generated\n\n* `src/api/models.py`: Pydantic models for requests and responses that mirror the domain objects. Used by `client.py` and `server.py`\n* `src/api/client.py`: Client classes with async methods, ready to make API calls with appropriate typings for request and\n response data.\n* `src/api/server.py`: Server handler classes, which include data serialization and domain logic invocation.\n\nThe generated code is complete, with no need for additional modifications.\n\n#### Examples\n\n- [my greeter](examples/my_greeter)\n\n### gRPC (not supported yet)\n\n**This framework support is not supported yet.**\n\n- unary-unary\n- stream-stream\n- unary-stream\n- stream-unary\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python codegen tool for transport layers in DDD, supporting most popular transport / API frameworks.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/zerlok/gendalf",
"Issues": "https://github.com/zerlok/gendalf/issues"
},
"split_keywords": [
"python",
" codegen"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3e978e1069f711b4468ae44cd84e309cbf2cafbf725e7946dc32590e3d8ab899",
"md5": "70dac32b63a3949332b3697560f2a72e",
"sha256": "ad5172d1cd6359ac8c8bf88ade24533d3c161bd3f81ac1c4638a04c27a5d543b"
},
"downloads": -1,
"filename": "gendalf-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "70dac32b63a3949332b3697560f2a72e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 26776,
"upload_time": "2025-08-02T22:50:59",
"upload_time_iso_8601": "2025-08-02T22:50:59.527517Z",
"url": "https://files.pythonhosted.org/packages/3e/97/8e1069f711b4468ae44cd84e309cbf2cafbf725e7946dc32590e3d8ab899/gendalf-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c05b8bc561afa6fe1ed159c910da3d6a8559d9f6fd2e1de3aa6433116edef647",
"md5": "7d2388076df040c43419bea541b5089b",
"sha256": "69337ba5b412cbaece5a24339a700dca747b574106a6a61a32bef9899edcc5b8"
},
"downloads": -1,
"filename": "gendalf-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "7d2388076df040c43419bea541b5089b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 23870,
"upload_time": "2025-08-02T22:51:01",
"upload_time_iso_8601": "2025-08-02T22:51:01.073305Z",
"url": "https://files.pythonhosted.org/packages/c0/5b/8bc561afa6fe1ed159c910da3d6a8559d9f6fd2e1de3aa6433116edef647/gendalf-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-02 22:51:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zerlok",
"github_project": "gendalf",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gendalf"
}