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.22.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.22.0
File Size Uploaded Provenance Actions
domainforge-0.22.0.tar.gz 813.8 kB Without provenance Details for domainforge-0.22.0.tar.gz

Built distributions (wheels)

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

Total release size: 28.6 MB

Release files / domainforge-0.22.0.tar.gz

Download URL domainforge-0.22.0.tar.gz
Size 813.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5402900ed975626ea96fb1ec2f47b3cb14bcac77c38f3eed0c1d5227592601bf
BLAKE2b-256 checksum
How to use checksums
805dc432e75319b64d802ec490376edf3f090b52d7795af3b541ed560c939371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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