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.18.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.18.0
File Size Uploaded Provenance
domainforge-0.18.0.tar.gz 695.4 kB Without provenance Details

Built distributions (wheels)

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

Release files / domainforge-0.18.0.tar.gz

Download URL domainforge-0.18.0.tar.gz
Size 695.4 kB
Tags Source
SHA-256 checksum
How to use checksums
104309276a083947ed86dc2fb93760755dcd0dee8b4a0664fc062d05dd58da5a
BLAKE2b-256 checksum
How to use checksums
160553a9a348d1c2e23254e42e426f961d7f222f38207f1fe3107a099037e6ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

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

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

Download URL domainforge-0.18.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
9a468f69b49be288dfd665de070b5c4035d0d7953ce4ecfa8a7ee5a9b10afb44
BLAKE2b-256 checksum
How to use checksums
475adbbd62146ef376e46974d97c592c974f3e50fa106a29980204c16abea140
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

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

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

Download URL domainforge-0.18.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
59636a1c14c7ceb43b6607985a1b0517263d915165caeecd6435a288292d7ad4
BLAKE2b-256 checksum
How to use checksums
67dc8e1a411a2961481a39776024f604f70fc9b3050965576be818d0aa76bf81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

Download URL domainforge-0.18.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
2802a7bc572eb669c802216c05f7910feebfa12e43edb1e157af64bcaea0653e
BLAKE2b-256 checksum
How to use checksums
58e95463d019a52692c934d7b88fa252a755a8a61e5f0b287a3b273d0525479a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

Security for domainforge 0.18.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