Skip to main content

Function-First framework for Domain-Driven Functions — self-describing CapabilityContracts, one definition reachable from every channel, optional durable execution via Temporal.

Project description

domaindriven

Function-First framework for Domain-Driven Functions — the DDF pillar of Domain-Driven Enterprise.

A function is the smallest self-describing unit of capability. You declare it once as a CapabilityContract (what it does, its invariants, who may call it, which domain events it emits), and it becomes reachable from every channel — REST, CLI, an LLM tool, a UI, a cron — through one invoke(). The execution substrate is swappable: in-process by default, or durable via Temporal without changing a single caller.

Core has zero required dependencies (stdlib only). YAML and Temporal are optional extras.

Install

pip install domaindriven                 # core
pip install "domaindriven[yaml]"         # + catalog YAML export / round-trip
pip install "domaindriven[temporal]"     # + durable execution via Temporal
pip install "domaindriven[all]"

Hello, function

from domaindriven import FunctionSpec, Param, register, invoke

def _handler(args, ctx):
    return {"greeting": f"Hallo {args['name']}"}

register(FunctionSpec(
    id="demo.greet", description="Grüßt eine Person", category="DEMO",
    returns="greeting", handler=_handler,
    params=[Param(name="name", type="string", required=True)],
    # — optionaler Capability-Contract (DDF/DDI/DDG) —
    bounded_context="Demo", decision="deterministic",
    invariants=("verändert keinen Zustand",), emits=("PersonGreeted",),
))

print(invoke("demo.greet", {"name": "Welt"}))
# {'ok': True, 'greeting': 'Hallo Welt', 'fx': {'id': 'demo.greet', 'worker': 'inline', ...}}

What you get

Modul Zweck
core Registry, CapabilityContract (FunctionSpec), register, invoke, Policy (Permission/Params)
worker austauschbares Ausführungs-Substrat (InlineWorker/ThreadWorker, set_worker)
loader load_package("meine_app") — Auto-Discovery selbst-registrierender Module
process ProcessSpec — Prozesse als Komposition von Funktionen (input/action/gate/view)
service HTTP-Worker (serve([...])) — REST-Kanal für die Registry
catalog JSON/YAML-Export, Traceability-Matrix, YAML→Contract Round-Trip
schema JSON-Schema (Editor-Autocomplete) + Scaffold-Template
naming durchsetzbares Namensschema (Linter)
temporal_adapter durable execution: TemporalWorker (Function→Activity, Process→Workflow)

Durable execution (optional)

from domaindriven import set_worker
from domaindriven.temporal_adapter import TemporalWorker
from temporalio.client import Client

client = await Client.connect("localhost:7233")
set_worker(TemporalWorker(client, "my-queue"))   # ab jetzt läuft jedes invoke() durable

Function → Activity (Retry/Timeout aus dem Contract), ProcessSpec → Workflow (gate→Signal, view→Query). Der PTDS-Kern passt exakt zu Temporals Determinismus-Grenze: decision="ai_assisted" gehört zwingend in eine Activity.

Status

Teil des dde-Monorepos. Alpha — API kann sich noch ändern.

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

domaindriven-0.1.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

domaindriven-0.1.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file domaindriven-0.1.0.tar.gz.

File metadata

  • Download URL: domaindriven-0.1.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for domaindriven-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a859fdaf92ff0722462b4daa85eb95aaf676913f0445e683ead2629d18d9d8c
MD5 ffd6c3c87d6e35a2596de02bf8517d57
BLAKE2b-256 1611d352934fd046584f293a8fea6944453a4b1dbb3a18147f37597b1d5f603c

See more details on using hashes here.

Provenance

The following attestation bundles were made for domaindriven-0.1.0.tar.gz:

Publisher: publish-domaindriven.yml on tobiasoberrauch/dde

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

File details

Details for the file domaindriven-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: domaindriven-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for domaindriven-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e94e64415eba34fc96c6e70c437bba8f5f0c93f578c62b44afed30e1491606b1
MD5 7eff3c5ceb0cb16bb86fa416f74ca3e4
BLAKE2b-256 f5b6e43ce8772c0a339d6e2634564ebfcbe31685596fe8f013c6bb0a436857b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for domaindriven-0.1.0-py3-none-any.whl:

Publisher: publish-domaindriven.yml on tobiasoberrauch/dde

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