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.18.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.18.2
File Size Uploaded Provenance
domainforge-0.18.2.tar.gz 700.5 kB Without provenance Details

Built distributions (wheels)

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

Total release size: 29.3 MB

Release files / domainforge-0.18.2.tar.gz

Download URL domainforge-0.18.2.tar.gz
Size 700.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6eba3b79bc4ed7557d95eab09142b598f885fec872774ab745e944e111b9aea1
BLAKE2b-256 checksum
How to use checksums
a62d73b1c67e802d6335996c1281f9c04337cb3d5e348ebf3a24b152db1c9df6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

Download URL domainforge-0.18.2-cp313-cp313-win_amd64.whl
Size 1.8 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
28f37a31d20b8a9b4b5f0a7918efd9a0324568eafb2df244cdd879e2783ad2cf
BLAKE2b-256 checksum
How to use checksums
55b445e8fe4fe797282c7143151a6970291e68d82e17f6c9152af6d801da2085
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

Download URL domainforge-0.18.2-cp313-cp313-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
2978005f559ed956fbdd96ec295d8fe35b109733e5bbd5211a2c89014da10562
BLAKE2b-256 checksum
How to use checksums
d65d72317d801f2b5f2ebaa8cee2052166ffed7f02542382d269be8896c7412a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.18.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL domainforge-0.18.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.1 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
e9721bed682406687864d97595a5e5fd7a724b48c4309a1836ca0544403cebca
BLAKE2b-256 checksum
How to use checksums
e886db09a40a52da3cde5f417d6c2571ae92b549e01d2170410f05685e0b315b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

Download URL domainforge-0.18.2-cp312-cp312-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
bb9ecbf2220e5ebc8242b5b2e817910d66f1069412b8dd272d80acb90c12e276
BLAKE2b-256 checksum
How to use checksums
be08efa7f52335d8bfe6b3da26500d760e8372a8e2b88b799a1a221f6d4ec9dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.18.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL domainforge-0.18.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.1 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
33cbcf034bf58dd69cf52fe804e588ea9c7ec22a8adacb6612f07c0b89b39e61
BLAKE2b-256 checksum
How to use checksums
55b84edf93142c33135879e9088eedd3177988c8936762878631c282b143c060
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

Download URL domainforge-0.18.2-cp311-cp311-win_amd64.whl
Size 1.8 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
5bb2d231b946f201bea5a94835f45d4cc254e8f4dddd324b7db2783a16eba5ab
BLAKE2b-256 checksum
How to use checksums
f499870e91e68bac0572fe49bceb1f7031329c84ec8a5c754cfe217436f5cbdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

Download URL domainforge-0.18.2-cp311-cp311-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
7421ecc4b65fefe5e6ebdd1cf2a189b7e0ac6b49d9a5e683957d5113acf9c258
BLAKE2b-256 checksum
How to use checksums
064d6139d6510625795a204bff771b033a1e8f094484b04c46f264bdeae5b12f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

Release files / domainforge-0.18.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL domainforge-0.18.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.1 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
cb054cf5d14bbc849f906c2731fc8a316bbdfb33fb130c486c59b3f3bef58835
BLAKE2b-256 checksum
How to use checksums
b3e03ef032e80b6b81fb28fee35a6ef407b679882d579f7a6273d3b942397f80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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