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

Built distributions (wheels)

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

Total release size: 22.6 MB

Release files / domainforge-0.21.0.tar.gz

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

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

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

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

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

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

Download URL domainforge-0.21.0-cp313-cp313-macosx_11_0_arm64.whl
Size 1.8 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8fe384e2d141bf4d653237b429fae870589c52e7ab5eaf62d057fda0d48abf99
BLAKE2b-256 checksum
How to use checksums
1b25fa0b99d7b609559bb715d2018de2681e5ca25d9a8ae52f016e8847b6ffbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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