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

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.21.2
File Size Uploaded Provenance Actions
domainforge-0.21.2.tar.gz 748.0 kB Without provenance Details for domainforge-0.21.2.tar.gz

Built distributions (wheels)

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

Total release size: 28.5 MB

Release files / domainforge-0.21.2.tar.gz

Download URL domainforge-0.21.2.tar.gz
Size 748.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b3f1e8e2a0481bff1435b54aec483a3d256e5d696b64e3961dd0363357f32add
BLAKE2b-256 checksum
How to use checksums
5870a12a59e6228c744d4deaa1787c730cae530b88b0a5b33d8e3616dc6b3d74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

Download URL domainforge-0.21.2-cp313-cp313-win_amd64.whl
Size 1.7 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
9729ac436f7921e0f8451f42e20b0fcf14315024fc208b65ffbc682379c21690
BLAKE2b-256 checksum
How to use checksums
192d12d3773513629f77e238edb0974e130bd5b3c54079fe01206ab803664d9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

Release files / domainforge-0.21.2-cp313-cp313-manylinux_2_28_aarch64.whl

Download URL domainforge-0.21.2-cp313-cp313-manylinux_2_28_aarch64.whl
Size 2.0 MB
Tags CPython 3.13 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
b8c237c589e3257ac3d179ba094cba7576a15eb9f8c55856b5a5967fbbc2bcf7
BLAKE2b-256 checksum
How to use checksums
53f5a353dfd2dadd38f30618148fdb66931850656956eb3159d0c8bf055baac1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

Download URL domainforge-0.21.2-cp313-cp313-macosx_11_0_arm64.whl
Size 1.7 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2920e6b6f17c5aede2995462c808a28b74d3b340c3d8dae929be67095ca55360
BLAKE2b-256 checksum
How to use checksums
aa07d85fbea50d8dd3328b131a483b6bbe1b19a57beff041ae0cfb3ff212887a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

Release files / domainforge-0.21.2-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL domainforge-0.21.2-cp312-cp312-manylinux_2_28_aarch64.whl
Size 2.0 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
16497390b87f7d47d7ad70e12ceafdb03a3029c9ce2c58b9ff04399d9aa865ab
BLAKE2b-256 checksum
How to use checksums
4ce1c725f5f229d3f47175db8c1b15ef43b3e02bcb3b8c8c84ba74bf2470ab37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

Download URL domainforge-0.21.2-cp312-cp312-macosx_11_0_arm64.whl
Size 1.7 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
783bbf3be55d0acbcc337a15e97b064fcf79f1ce2cd2f713928e57580ba3dd41
BLAKE2b-256 checksum
How to use checksums
5649fd0992b099b3b04751394d7bf1d764ed4828d097f1a8549bc6c0b7cd7088
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

Download URL domainforge-0.21.2-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
5e661803e74a1553b05f24ae22cc75b9706b7e7080ed1212c14174724ea88208
BLAKE2b-256 checksum
How to use checksums
8a5b41e97c3850abc68f4931ed4023bc7fd07b1fe917e3c92c3392b5cda824d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.21.2-cp311-cp311-manylinux_2_28_aarch64.whl

Download URL domainforge-0.21.2-cp311-cp311-manylinux_2_28_aarch64.whl
Size 2.0 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
e31f10b976f8166bd759d39cc914a6eb89d66559189eb3861d3a81b930b34729
BLAKE2b-256 checksum
How to use checksums
bb7a233c3fe2277a7ffc3bd884609489e6aaec18b4798495278c4d4c101bf065
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

Security for domainforge 0.21.2

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