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

Parsed graphs expose declaration-ordered read access to policies, metrics, mappings, projections, patterns, concept changes, entity instances, and source declared dimensions and units. SourceUnit.base_factor is an exact decimal string; mapping and projection rule details are available through rules_json and overrides_json.

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.

Metadata

Release files for domainforge 0.20.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.20.0
File Size Uploaded Provenance
domainforge-0.20.0.tar.gz 716.7 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for domainforge 0.20.0
File
domainforge-0.20.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
domainforge-0.20.0-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details
domainforge-0.20.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
domainforge-0.20.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
domainforge-0.20.0-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
domainforge-0.20.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
domainforge-0.20.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details
domainforge-0.20.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
domainforge-0.20.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
domainforge-0.20.0-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
domainforge-0.20.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
domainforge-0.20.0-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details
domainforge-0.20.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
domainforge-0.20.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
domainforge-0.20.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.5 MB

Release files / domainforge-0.20.0.tar.gz

Download URL domainforge-0.20.0.tar.gz
Size 716.7 kB
Tags Source
SHA-256 checksum
How to use checksums
61d853a42c8638433ea22e6063ea46eb05d15d19c43c096ec360f6b058362fca
BLAKE2b-256 checksum
How to use checksums
9811cdfd77aa29314bd960d695c839fb6f9be07e858ed169b99015323a34036e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

Download URL domainforge-0.20.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.1 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
dcde94c705cc1fd7298bd0474eb28bc369b212326d48b40b5d5f7a86d6fd8a92
BLAKE2b-256 checksum
How to use checksums
3963e987ea8c85e71f22703675db058447b2aa5e0bbc46c585c54a74f55ef0a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

Download URL domainforge-0.20.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
26c6389b10d22538f97d4d8f75f67409de554658fb21210ad5f37d00eb0ada26
BLAKE2b-256 checksum
How to use checksums
72c95b7400f9e4903fe066e51d270cf609e8b1888a3ed6b1c6084a7bac092ade
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

Download URL domainforge-0.20.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.1 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
559ec77f49c99e13612761d9175add54ccd3c151559f4b09b2de63226330aef7
BLAKE2b-256 checksum
How to use checksums
a7696fe3b8e42298dac110b5e72d817f277f27ca3b90ef1a8f19f99484958faa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

Download URL domainforge-0.20.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
0ff24a42de3c0cf69db3c985be7e50409eca662ad051018eaa9f14f78e07ace2
BLAKE2b-256 checksum
How to use checksums
4d206ff034de966c3f88897ca6b9ed67b52857a5f15fcead243d6f995ddff1cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

Download URL domainforge-0.20.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
289f98bdd4a140ff4a93272c1b8b18375a42b9cc405fbb63d46139732c4700bc
BLAKE2b-256 checksum
How to use checksums
47cff478056a989c45746a65a9e9f85a2dd9769f198233f2e49665f797ed4211
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

Download URL domainforge-0.20.0-cp311-cp311-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
854ec97c7dce264ed7edc896d2b829933f66032db75b25ef868ea2502aac24da
BLAKE2b-256 checksum
How to use checksums
84754ac47e1eda95fb24b68093061994d523867a816a5c8580cb0c30554ff2d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

Download URL domainforge-0.20.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
ef7fe8c6e2e7f517519b109d30d813e9d020b3b53aff072a315def2713bd79b8
BLAKE2b-256 checksum
How to use checksums
6f48c48210f2c7a24f16775288c82511371e36d80be3a1e9276308fbb1bd7779
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

Security for domainforge 0.20.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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