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

Built distributions (wheels)

Table of built distributions (wheels) for domainforge 0.22.2
File Actions
domainforge-0.22.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for domainforge-0.22.2-cp313-cp313-win_amd64.whl
domainforge-0.22.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.22.2-cp313-cp313-manylinux_2_34_x86_64.whl
domainforge-0.22.2-cp313-cp313-manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64 Details for domainforge-0.22.2-cp313-cp313-manylinux_2_28_aarch64.whl
domainforge-0.22.2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for domainforge-0.22.2-cp313-cp313-macosx_11_0_arm64.whl
domainforge-0.22.2-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details for domainforge-0.22.2-cp313-cp313-macosx_10_12_x86_64.whl
domainforge-0.22.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for domainforge-0.22.2-cp312-cp312-win_amd64.whl
domainforge-0.22.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.22.2-cp312-cp312-manylinux_2_34_x86_64.whl
domainforge-0.22.2-cp312-cp312-manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64 Details for domainforge-0.22.2-cp312-cp312-manylinux_2_28_aarch64.whl
domainforge-0.22.2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for domainforge-0.22.2-cp312-cp312-macosx_11_0_arm64.whl
domainforge-0.22.2-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details for domainforge-0.22.2-cp312-cp312-macosx_10_12_x86_64.whl
domainforge-0.22.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for domainforge-0.22.2-cp311-cp311-win_amd64.whl
domainforge-0.22.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.22.2-cp311-cp311-manylinux_2_34_x86_64.whl
domainforge-0.22.2-cp311-cp311-manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64 Details for domainforge-0.22.2-cp311-cp311-manylinux_2_28_aarch64.whl
domainforge-0.22.2-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for domainforge-0.22.2-cp311-cp311-macosx_11_0_arm64.whl
domainforge-0.22.2-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details for domainforge-0.22.2-cp311-cp311-macosx_10_12_x86_64.whl

Total release size: 28.6 MB

Release files / domainforge-0.22.2.tar.gz

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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