Skip to main content

Bendykit

Code generator for Python backends following DDD principles.

Describe your domain in a single Python file, get a full stack: domain models, repository, use cases, DTOs and FastAPI routers. Architecture is Onion, no ActiveRecord, strict layer separation.

Installation

pip install bendykit

Usage

# manifest.py
from decimal import Decimal
from enum import Enum
from typing import Optional
from datetime import datetime

from bendy import Aggregate, ValueObject, Field, auto_now


class OrderStatus(Enum):
    PENDING = "pending"
    CONFIRMED = "confirmed"


class Address(ValueObject):
    street: str
    city: str
    country: str = "US"


class Order(Aggregate):
    customer_id: str
    total_amount: Decimal
    status: OrderStatus = OrderStatus.PENDING
    shipping_address: Address
    notes: Optional[str] = None
    created_at: datetime = auto_now

    class Meta:
        use_cases = ["create", "get", "update", "delete", "list"]
bendykit manifest.py ./src

Generates for each aggregate:

src/order/
├── domain/
│   ├── models.py        # @dataclass Order
│   ├── enums.py         # OrderStatus(Enum)
│   ├── value_objects.py # @dataclass(frozen=True) Address
│   └── repository.py    # OrderRepository(ABC)
├── application/
│   ├── dtos.py          # OrderCreate / OrderUpdate / OrderResponse
│   └── use_cases.py     # Create/Get/Update/Delete/ListOrderUseCase
├── presentation/
│   └── router.py        # FastAPI router
└── infrastructure/
    ├── models.py        # OrderModel(Base) — SQLAlchemy 2.0
    └── repository.py    # SqlalchemyOrderRepository + mapper

Types

Manifest Python SQLAlchemy
str str String
int int Integer
float float Float
bool bool Boolean
Decimal Decimal Numeric
datetime datetime DateTime
date date Date
UUID UUID String
Optional[X] Optional[X] nullable=True
MyEnum(Enum) MyEnum String + mapper
MyVO(ValueObject) MyVO JSON

Manifest primitives

  • auto_now — value is set server-side, excluded from Create/Update DTOs
  • Field(unique=True, index=True, max_length=N) — column metadata
  • ValueObject — nested object without id, stored as JSON
  • Meta.use_cases — operations to generate: create, get, update, delete, list (default: create, get)

Roadmap

  • Phase I — CLI generator
  • Phase II — Python manifests (Enum, ValueObject, Field, auto_now, Meta)
  • Phase III — bendykit.runtime: Unit of Work, Domain Events

License

MIT

Metadata

Release files for bendykit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bendykit 0.1.0
File Size Uploaded
bendykit-0.1.0.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bendykit 0.1.0
File Interpreter ABI Platform
bendykit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.0 kB

Release files / bendykit-0.1.0.tar.gz

Download URL bendykit-0.1.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cd9d2502bd8ef9352192d2ad78242e1025ca1510042b07f2dc00a69f3100ff2c
BLAKE2b-256 checksum
How to use checksums
78495abbd1b7b914f6cfc828826467625cf3aab6ccdf5b19a19ab1665aa55106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / bendykit-0.1.0-py3-none-any.whl

Download URL bendykit-0.1.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1695ce66127b9e5d2c420adb53ca04da0b4d8c4c9a7397472625aa7b4b585629
BLAKE2b-256 checksum
How to use checksums
7171fcb1d6c01923625895b876e46aac505d5a1b115458197b09698e41bbf883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page