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/
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.

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.

Release files for domainforge 0.17.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 domainforge 0.17.0
File Size Uploaded
domainforge-0.17.0.tar.gz 687.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for domainforge 0.17.0
File
domainforge-0.17.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
domainforge-0.17.0-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details
domainforge-0.17.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
domainforge-0.17.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
domainforge-0.17.0-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
domainforge-0.17.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
domainforge-0.17.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details
domainforge-0.17.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
domainforge-0.17.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
domainforge-0.17.0-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
domainforge-0.17.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
domainforge-0.17.0-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details
domainforge-0.17.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
domainforge-0.17.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
domainforge-0.17.0-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details

Total release size: 29.1 MB

Release files / domainforge-0.17.0.tar.gz

Download URL domainforge-0.17.0.tar.gz
Size 687.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d68e7dac4eef0c20113bdfb5aa0cdba4b5d8cc5238b9673881a1673f0ea289c7
BLAKE2b-256 checksum
How to use checksums
2818cb29597ffdef847e0ea2b7ff1bb6da66cddb5acc3652c30f2513574edcaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp313-cp313-win_amd64.whl

Download URL domainforge-0.17.0-cp313-cp313-win_amd64.whl
Size 1.8 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
5834af3913785b215daf05d6c526e8b44ccab0445a3151072108d8c64348941c
BLAKE2b-256 checksum
How to use checksums
968b3ba09ca7ca94a19e7ad27bbc4c720ed730caf567016fdd11edf6e4a69a0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL domainforge-0.17.0-cp313-cp313-manylinux_2_34_x86_64.whl
Size 2.0 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
eadef6e5be6fb770f846e00e2bcecea866e6e7782060da4cb8a4ee6fa60c2de5
BLAKE2b-256 checksum
How to use checksums
aa299e4d97a1569a0a2593090023c01d1e9ef89c648dea3baf9645d446078dae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL domainforge-0.17.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.0 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
1fe491cb4f3ba5be249617d8dd978873ecaf1b1789babb7929b029c9e6c3b6c0
BLAKE2b-256 checksum
How to use checksums
7d69a98331c62a71d3b4a147d535bdebb03da0eb5f220f2069998d8bc5361d3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL domainforge-0.17.0-cp313-cp313-macosx_11_0_arm64.whl
Size 1.8 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7f06d312cc0934f3c895e2910fa942d806b99a22e2cccf4fe6283a665d2453d1
BLAKE2b-256 checksum
How to use checksums
8331639096ec05193489c154cb38725cb0a235e14057b5c2e5d16a3c5561993f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp313-cp313-macosx_10_12_x86_64.whl

Download URL domainforge-0.17.0-cp313-cp313-macosx_10_12_x86_64.whl
Size 1.8 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4b0b3d2ff58388441380ae5ea8aacff8f0e122069173d7b3a70d03f6e5ef6bd2
BLAKE2b-256 checksum
How to use checksums
6262bbe3e07e8e20c233507a90ac9dd8e041c653dbf92488bd456b21f92138b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp312-cp312-win_amd64.whl

Download URL domainforge-0.17.0-cp312-cp312-win_amd64.whl
Size 1.8 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
db345bceee243759eabdd36404e540b702cda8cda14c317fa039b876c850fc56
BLAKE2b-256 checksum
How to use checksums
0af4d2311c02150a79de7a99ab7acef7e294cbe2c3ce46edbce8a42b8e302429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL domainforge-0.17.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 2.0 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
d250f813afc8cca50907dcc7e75bf5dc5d95f5d84d7f9627725a478d907b5bba
BLAKE2b-256 checksum
How to use checksums
c914d05680bc7c170759de74af20611cbe0c8b76a57dc51f78f8198b04a595f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL domainforge-0.17.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.0 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
54156141535c1e7ee0b36a373d54cd10180de8418e2da1b29fb0cac420c41abf
BLAKE2b-256 checksum
How to use checksums
0d1baf3a075ac8ca9ea05972418c1fe654e81ebc27fd5c4757833f4d789d8c17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL domainforge-0.17.0-cp312-cp312-macosx_11_0_arm64.whl
Size 1.8 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3fec63111e50d1627f7e221c9e120d3e017bd83f4129b46aded5ae4c8e96df5f
BLAKE2b-256 checksum
How to use checksums
7a4f0834dd60c9f6ad5dc618a9fa2fe43fa501298b3055db18f023997ffedd5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp312-cp312-macosx_10_12_x86_64.whl

Download URL domainforge-0.17.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 1.8 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
24a2cc6ad6cc916666dcbc2dd79b2ae52995ae85021b4090f177ebce3399848f
BLAKE2b-256 checksum
How to use checksums
fa8503818d490cbc9e5789bb84b06d07f13081715aa35a555ad52da18a0028a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp311-cp311-win_amd64.whl

Download URL domainforge-0.17.0-cp311-cp311-win_amd64.whl
Size 1.8 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
5b14c00d716ca6604c53f5466fd98ffec865a92a7524ff406e9321e6b770e83f
BLAKE2b-256 checksum
How to use checksums
019037a5d16e728ee467c218696ce03a971b0fa3932eb0001ee9d418d72ab685
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL domainforge-0.17.0-cp311-cp311-manylinux_2_34_x86_64.whl
Size 2.0 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
1551f4d9236853a12d51f443da8ac8ff5a07c11e1be434d6bdb244988c3ca27d
BLAKE2b-256 checksum
How to use checksums
7f1b6095902506757756d46768fff5b8813fbc874fde12b29f019dd1f6732182
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL domainforge-0.17.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.0 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
d5cdc12c7e910dcf582cde179f863cf5b1c61fcf4d5d01542bb9aec5c0f3af97
BLAKE2b-256 checksum
How to use checksums
ab724ad7622c80415700886dfc8223e57238edaff25142ab930bedddd1063ed0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL domainforge-0.17.0-cp311-cp311-macosx_11_0_arm64.whl
Size 1.8 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c06308995308a38f3b2072ea21d32c6ee73e3affb466bc6658e6772b53b19af9
BLAKE2b-256 checksum
How to use checksums
4d0af44f55666c04ec40d81e7a26757464334bb404d7e9349ed53835a3811d91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.17.0-cp311-cp311-macosx_10_12_x86_64.whl

Download URL domainforge-0.17.0-cp311-cp311-macosx_10_12_x86_64.whl
Size 1.8 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d47f368452b7687602c664ea96a4fad9a6f73ac568ae96a0d9516bd1abb35418
BLAKE2b-256 checksum
How to use checksums
16752ae24df9c2403c4f88ff57ebea5286dccdbf2a0891ab639da28236c29666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release history Release notifications | RSS feed

This release

0.17.0 This release

16 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