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

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.1
File Size Uploaded Provenance
domainforge-0.21.1.tar.gz 747.3 kB Without provenance Details

Built distributions (wheels)

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

Total release size: 28.5 MB

Release files / domainforge-0.21.1.tar.gz

Download URL domainforge-0.21.1.tar.gz
Size 747.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bfcf4ced11d9baeaa8bf2d4eaac7143c5f5229edf8c42bb2a830828ef1a1efe4
BLAKE2b-256 checksum
How to use checksums
30ae5db39892a32cbe9b3a6fdd746c0bae8e636145f20d1d1ea17c3fae8cebec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Download URL domainforge-0.21.1-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
4e912b23f12c9d6254361b1eb1484bda661340a8bbac8f1793bf52cfd9c0a64d
BLAKE2b-256 checksum
How to use checksums
87a66b9d236188bcdec7a9f2e019cbc480ffcf67ab72e43e02341f8da3a5689a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

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

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

Download URL domainforge-0.21.1-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
10878bb2d7b611c2886697a96c5700a4ce830747ead1d579cc382fb8f00366fe
BLAKE2b-256 checksum
How to use checksums
562aaa32cc4907fcfe647074716c529a8330beb15475ecf08c8226e04c53e3fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

Security for domainforge 0.21.1

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