Skip to main content

SEA DSL

PyPI Python Versions License CI

Python bindings for the SEA DSL (Semantic Enterprise Architecture) domain-specific language. Part of the DomainForge ecosystem.

Features

  • 🏗️ Domain Primitives — Entities, Resources, Flows, Roles, Relations, Instances
  • 📐 Unit System — First-class dimensional analysis with type-safe quantities
  • Policy Engine — Constraint validation with three-valued logic
  • 🔄 DSL Parsing — Parse SEA source code into queryable graph structures
  • 🌐 CALM Integration — Export/import FINOS CALM architecture-as-code format
  • Native Performance — Rust-powered core via PyO3

Installation

pip install domainforge

Requires: Python 3.11+

Quick Start

Parse from DSL

import domainforge

source = '''
    @namespace "supply_chain"

    Entity "Warehouse" in logistics
    Entity "Factory" in manufacturing

    Resource "Cameras" units

    Flow "Cameras" from "Warehouse" to "Factory" quantity 100
'''

graph = domainforge.Graph.parse(source)

print(f"Entities: {graph.entity_count()}")
print(f"Resources: {graph.resource_count()}")
print(f"Flows: {graph.flow_count()}")

Build Programmatically

import domainforge

graph = domainforge.Graph()

# Create primitives
warehouse = domainforge.Entity("Warehouse", "logistics")
factory = domainforge.Entity("Factory", "manufacturing")
cameras = domainforge.Resource("Cameras", "units")

graph.add_entity(warehouse)
graph.add_entity(factory)
graph.add_resource(cameras)

# Create flow
flow = domainforge.Flow(
    cameras.id(),
    warehouse.id(),
    factory.id(),
    100.0
)
graph.add_flow(flow)

# Query the graph
for entity in graph.all_entities():
    print(f"{entity.name()} in {entity.namespace()}")

Work with Attributes

entity = domainforge.Entity("Warehouse")
entity.set_attribute("capacity", 10000)
entity.set_attribute("location", "New York")

print(entity.get_attribute("capacity"))   # 10000
print(entity.get_attribute("location"))   # "New York"

CALM Integration

# Export to CALM JSON
calm_json = graph.export_calm()

# Import from CALM
imported_graph = domainforge.Graph.import_calm(calm_json)

API Reference

Core Classes

Class Description
Entity Business actors, locations, organizational units (WHO)
Resource Quantifiable subjects of value (WHAT)
Flow Transfers of resources between entities
Instance Entity type instances with named fields
ResourceInstance Physical instances at entity locations
Role Roles that entities can play
Relation Relationships between roles
Graph Container with validation and query capabilities

Graph Methods

# Add primitives
graph.add_entity(entity)
graph.add_resource(resource)
graph.add_flow(flow)
graph.add_instance(instance)
graph.add_role(role)
graph.add_relation(relation)

# Counts
graph.entity_count()
graph.resource_count()
graph.flow_count()

# Lookup
graph.find_entity_by_name("Warehouse")
graph.find_resource_by_name("Cameras")

# Flow queries
graph.flows_from(entity_id)
graph.flows_to(entity_id)

# Get all
graph.all_entities()
graph.all_resources()
graph.all_flows()

# Policy evaluation
graph.add_policy(policy)
graph.evaluate_policy(policy_json)
graph.set_evaluation_mode(use_three_valued=True)

# CALM integration
graph.export_calm()
Graph.import_calm(json_str)

NamespaceRegistry

# Load workspace registry
reg = domainforge.NamespaceRegistry.from_file('.sea-registry.toml')

# Resolve files
for binding in reg.resolve_files():
    print(f"{binding.path} => {binding.namespace}")

# Query namespace for file
ns = reg.namespace_for('/path/to/file.sea')

Development

Building from Source

# Clone the repository
git clone https://github.com/GodSpeedAI/DomainForge.git
cd DomainForge

# Install maturin
pip install maturin

# Build and install in development mode
maturin develop

# Run tests
pytest tests/

Using Just (Recommended)

just python-setup    # Create venv and install deps
just python-test     # Run test suite
just python-clean    # Remove venv

Platform Support

Pre-built wheels are available for:

Platform Architectures
Linux x86_64, aarch64
macOS x86_64, arm64 (Apple Silicon)
Windows x86_64

Build from source for other platforms.

Related Packages

Package Registry Description
domainforge-core crates.io Rust core library
domainforge PyPI Python bindings (this package)
domainforge npm TypeScript/Node.js bindings

Policy Authority

DomainForge includes a Policy Authority system for executable business authority:

from domainforge import AuthorityEnvironment, evaluate_authority

# Create and validate environment
env = AuthorityEnvironment(config_json)
env.validate()

# Evaluate a request
trace_json, decision_json = env.evaluate(request_json, facts_json)

# Or use the convenience function
trace, decision = evaluate_authority(config_json, request_json, facts_json)

Available types:

  • FinalDecision — Allow, Deny, Escalate, NotApplicable, Reject
  • PolicyModality — Permission, Prohibition, Obligation, Override
  • SourceClass — CallerSupplied, RuntimeObserved, SystemOfRecord, Attested, ManualApproval, Derived, UnknownSource
  • ClaimLevel — AuditBacked, Validated, FormallyProven
  • AuthorityEnvironment — Full authority evaluation environment
  • evaluate_authority() — One-shot evaluation function

Documentation

License

Apache-2.0


Part of the DomainForge project.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

domainforge-0.15.0.tar.gz (638.8 kB view details)

Uploaded Source

Built Distributions

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

domainforge-0.15.0-cp313-cp313-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.13Windows x86-64

domainforge-0.15.0-cp313-cp313-manylinux_2_34_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

domainforge-0.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

domainforge-0.15.0-cp313-cp313-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

domainforge-0.15.0-cp313-cp313-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

domainforge-0.15.0-cp312-cp312-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.12Windows x86-64

domainforge-0.15.0-cp312-cp312-manylinux_2_34_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

domainforge-0.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

domainforge-0.15.0-cp312-cp312-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

domainforge-0.15.0-cp312-cp312-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

domainforge-0.15.0-cp311-cp311-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.11Windows x86-64

domainforge-0.15.0-cp311-cp311-manylinux_2_34_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

domainforge-0.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

domainforge-0.15.0-cp311-cp311-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

domainforge-0.15.0-cp311-cp311-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file domainforge-0.15.0.tar.gz.

File metadata

  • Download URL: domainforge-0.15.0.tar.gz
  • Upload date:
  • Size: 638.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.1

File hashes

Hashes for domainforge-0.15.0.tar.gz
Algorithm Hash digest
SHA256 3a12ff9bed4ac2d51109a3942ddb955b66725e4cb70231ac78d205f9e1ca2542
MD5 a8feec10b2d78a0d55841049d4419ebc
BLAKE2b-256 7bf2d0b638546ac9121c4600eb5885e04f070d87f8afbb87cfe2faea767dc28d

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6c7e274b27b3d3b0806afb070bf3530a862e74246e62c091d853278387e9f3ba
MD5 1c2e82268be5e492b466e79ae56bbcd8
BLAKE2b-256 bc06f223228713a91c68292612cb708531bb06985c5d17772e078753f0a15657

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7cfd39c53c983a3c14f8d7d4aa605a86de302dd39312a3ff3f51c1b9007bac2c
MD5 eb2f18d8e4e720d8766ff2af6e35f5ae
BLAKE2b-256 ff829af04e266bda5297aee13292c9d00337f5e38b6afd676acffaa96f22a8f9

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c4f32f289d1cf1f3b989a42ce962954e2e8400be5edfc2a3e621d6df45188693
MD5 0d87a8cc4553885c78a5615c55543563
BLAKE2b-256 b9f5650653ded7253e2c91e02f460109e2a2fdd6c9617db9fecb9e10bda879ba

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e8baeb37e0f478c37cd617eb73f7a1a7083f9313f8e70babba05fbd20368d51
MD5 ecd1947e251d0d62d8d8d5127fa77158
BLAKE2b-256 bf0e1fb543d697f1362591e3071ee82e0daacd122e31d6c042682fe3f1b48e68

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e1408d936ce48cdefcc84bf00c5ab29d40e0e4aa2dfc0d82b10a87a1f64cf528
MD5 f9a27c3640c192eb82ec4c5bd8ff205b
BLAKE2b-256 9d51266a64dfb41db05db85821fb42c1c19e9be3a92197357e1ac3944fda5a29

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1bf8990cb6bf2f02a167d057815f8fa7b6d4cca790954f277cfb2189b96512a0
MD5 df5fd3ce434ae5a4e92924754de0dcda
BLAKE2b-256 774ec5599de85cf749cb024631684c70834cd53babef9f2f4cfe556f515d7046

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d882e6d279c4916d54e164d87a3bd935bd1ab8f14add4a6c75060f1922c72d23
MD5 9267a3359ccdfac4a6933c491524bdc9
BLAKE2b-256 a4b0a797fb13aff1378d3c0ca94ad9238ab482d4a3091cd118b0a16fb524f107

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 172c4856f1f85fe505e4ececdb711d5912a0b6ffa644c81cd707480dfd5404b8
MD5 fc5d56669b5002447a3a5b76b9c9d080
BLAKE2b-256 7661e29253c331187b47d7d80ff9b4be241269f44bdf76042433574878442a41

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 428a246da9bfa70f90662d20f1b0bf70b4d443b35003e8c8fa42ff2ed7d4bb7a
MD5 17288001b576ed603ffc0181425add75
BLAKE2b-256 65da2376fdfcf0f9b945db2cbb0c155cb8bdbde9aff1b3853644583d23b4a9d8

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ecc99b58e0e06b80be4c3e08d52abb7545b2e7d049cdc7f1b4e1bfe5c3b63821
MD5 3ad60b7396e4b8ec5c581611bb92092f
BLAKE2b-256 d18fcf26766a83a2209d780df8c69ede32fb8ec34c5329b33f2941cd24100095

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e1ccdba8b19271826cc2e3cc4c5bec29985e3a25b5aa1aade47411bdfd70772b
MD5 0dea51396cee5e6fcc3ce59825fdf9fc
BLAKE2b-256 038db82af4c9299be35316497c0b658013c365caeda35e7dbbeb7d90759d9dc2

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5cf71ccce79516b94ba8516f5ffad45c67b2901d48ca6ed67415b42e4988d126
MD5 db2ff82e3da463c00d78646d3c0b5b1f
BLAKE2b-256 86df9838a420ed474862fb441a0e75859a4de2cb66e19d60e7b2597dedc61295

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 939baad8edd264139a3a26dcb363d0dc6dae1d69504df6a196c421b83d7219a7
MD5 1cc83f83d119f8d5e18e5fd0e0c74f0b
BLAKE2b-256 f68a41e27face93d8f7a3abc7414351236e21e885fe7aff11582adf6c116bddc

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8295952bdb52dcb19357b46b14965bd7e1dfa8faa6334844a0f091bf46a180f9
MD5 b0f1efc2b0d3f70983432235c1062f06
BLAKE2b-256 76df4e492bb7fdefb6eb8178f8c4f7921ca2b01c3aa98051252c3bc657339b84

See more details on using hashes here.

File details

Details for the file domainforge-0.15.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.15.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2c1fe712ac0384a45dcc12e1a08f31589822f09b9d9bdd53b7b5ba8a4c92d7d0
MD5 1bd41bfba294e672fc65b6ad30f92107
BLAKE2b-256 072c630acbfee89ec27b76af7c0f60cfb4f51a6f07f37b5de3db4f61f407f734

See more details on using hashes here.

Release history Release notifications | RSS feed

0.16.0

16 files

This release

0.15.0 This release

16 files

0.14.0

16 files

0.13.0

16 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