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/

Using Just (Recommended)

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.

Related Packages

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

domainforge-0.16.0.tar.gz (649.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

domainforge-0.16.0-cp313-cp313-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.13Windows x86-64

domainforge-0.16.0-cp313-cp313-manylinux_2_34_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

domainforge-0.16.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

domainforge-0.16.0-cp313-cp313-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

domainforge-0.16.0-cp313-cp313-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

domainforge-0.16.0-cp312-cp312-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.12Windows x86-64

domainforge-0.16.0-cp312-cp312-manylinux_2_34_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

domainforge-0.16.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

domainforge-0.16.0-cp312-cp312-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

domainforge-0.16.0-cp312-cp312-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

domainforge-0.16.0-cp311-cp311-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.11Windows x86-64

domainforge-0.16.0-cp311-cp311-manylinux_2_34_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

domainforge-0.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

domainforge-0.16.0-cp311-cp311-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

domainforge-0.16.0-cp311-cp311-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file domainforge-0.16.0.tar.gz.

File metadata

  • Download URL: domainforge-0.16.0.tar.gz
  • Upload date:
  • Size: 649.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.1

File hashes

Hashes for domainforge-0.16.0.tar.gz
Algorithm Hash digest
SHA256 5f2ee2b48e8a4645d8f13afa23e414e04499d9e3c4db6315b222e309fed67dff
MD5 400b11dc417835ffde53c7d8f3800d63
BLAKE2b-256 524abd9f9d7fb0b33b8267ec9ab0fa1e245a2414e1e6c5286200b2773c0070a8

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4a9527b7b3e2b20a6d81880706f54b9f6488903cdf21bf50ee7b3f2dfa7743e9
MD5 087a6bce451a1eba7148c015420e80c9
BLAKE2b-256 feeee4d461183e915c3f35e10018397f7253d2a059536d8664b026e65f3f2a3c

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a44c02b9af1ced98eff374e49f36d96f734662566a86d7277c6ce946fc45b34e
MD5 5e638e96571f510c8f8dc09dd46e4995
BLAKE2b-256 ee79c08609201f4a37bf1efd9c2f18b3eb2a14f7c3b154f0938ad96f25d3418e

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 859dbfe326de0b5498873e9aa380737f91cb2818092904779782c2c3dfac5539
MD5 f5336a5526d9c182cc3958d151492145
BLAKE2b-256 63bcdaedbf36e165c379a283f1b6d93a8db60905e4ef125b62f3b0d097bf2cb5

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb1e2e18b79edf3fcdb42b8c949c606035defe2bec9809f703afb3e73a4ea6c6
MD5 7a82749bab72a8946cc65c97d86c62d5
BLAKE2b-256 4f15059b831863c78a93cdc23c438190cbc3d67ff79033d50b3d75b67ef807d5

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d1425c9b2ecddf574d8dbb3ed199cf87a7b2f99fb2ff5f0288f4b9170a798547
MD5 4ce93928045f236e928b98f4b0299112
BLAKE2b-256 db5817955deda3347404d2b5c00697db5411022db2daf5b1dd4c4cdd3d9e0cd8

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0ef10cfadb13adb30dfb4e36ebc2a4a24635321194ec1d8982b03114809fb4f6
MD5 d170b470ec4e90ab81f3c2c94a1efa86
BLAKE2b-256 c0adf98d2720e5b552d5299d2018412da0ade8a2a72276b409640670d99db2e6

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 10d380932b1d6709c9b45f704a66088f85e8525088dc548b772eabac6899cf55
MD5 f32d91607933c646eb94939aa0872503
BLAKE2b-256 83b865a2467126ed4ced84afc78ffa32366d8ca53c5b3550ecdf94c957be9ade

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e683f7fea91d01a209769f81118f56ae9ec894ca94ede1eafeb190ff7a11011d
MD5 79f20286b03e554e263fbb0bae2f871a
BLAKE2b-256 47a1c00c4404c519d760c299d9a54b3c2ee921ca1adf2ec4540649d1a3968d84

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79e571dae5cfce75cd63b4ea2f1b8eba238bd2f32d02dbb80cff859392d06604
MD5 4b3ec66137ae9847d8f734f588ec48c9
BLAKE2b-256 0eae13b15f67efd091f43f0b48f968d6c3fa96b4a7f9383f11e767560161b33a

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b7dd0e5d28b367ff15bebe66d2d3e9b1bf8689fb4e174c829df57b925b0ede20
MD5 f576f4026e020450629181b001ab94b2
BLAKE2b-256 145cc905affe69820c61842b86314dea724d85cf1b87c5f77ef1b2684825fc44

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c6541cc9c7492a1462cf83cb5be189d2c84d2e39a7ab10a5098af2d594f26d28
MD5 cca201c4f7a142ce237b7e45ae4d4656
BLAKE2b-256 c7924e23ec8b8d1415a84eee0c9904a4e39c48c60deecf5bc3e5bc1b50289367

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ec2ab339bc327b7301dc796271b71ef2502a3d90c0902175579e721cbe512deb
MD5 1c44c6fc8d87298cab408bf84e427801
BLAKE2b-256 40247c1e78d7f456e8c71da717c39a5a8d5af04b6dd261b6e301cf0eefeab702

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 702c1b68f279ae0be159c0e23e48533b59e49ad4dcfb19093173866fc241dc97
MD5 8c53ad9573758326096f69894d7e6db3
BLAKE2b-256 f8492adcbce6a9a6861f0e2f802e0bb75b083848d141feccdcb310ad2dcb28eb

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e29405e49f6717859f55ba7a2d3ba4e226245249885c9368a2e543545ee1ef08
MD5 5ac29bdba67ef6f7bd5917322a77b127
BLAKE2b-256 78c25b6d2fa19ad60472fe8f95a9bb93f5d4bbd9bb71a99c8e99b2c82e824e1d

See more details on using hashes here.

File details

Details for the file domainforge-0.16.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for domainforge-0.16.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c0950aca6af959ebfac7ab5a75b4677b66984e4cebb957c241d5b575c5b2bc58
MD5 eaca1b84d22dc9572c5f05c15d6a24f7
BLAKE2b-256 31cab9e18d124b1c51ea4f90af9e86c32835abd350cabd9c206269229a5bae49

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.16.0 This release

16 files

0.15.0

16 files

0.14.0

16 files

0.13.0

16 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