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.1

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

Built distributions (wheels)

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

Total release size: 28.6 MB

Release files / domainforge-0.22.1.tar.gz

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

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

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

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

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

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

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

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

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

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

Download URL domainforge-0.22.1-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
383eb0111891727e3d032b01c299bc3054857e8f23cc1c0410405087a12f439b
BLAKE2b-256 checksum
How to use checksums
59453e74cd9136fccf12caae5172aa1204ba904cc30ad5f41facc47becc068ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

Download URL domainforge-0.22.1-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
107c407203bac4e3aab3c561d68a2624a7efa4786019b9ce0d58b3684552e242
BLAKE2b-256 checksum
How to use checksums
53026b5cd1a43d8b68fa8333021bfdcdae4eb5417d18ef1d8540f197acbc6f1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

Download URL domainforge-0.22.1-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
75bc051d74ed333d03c8fbb73a523e3a2c2b394504b2766b3a1bf2e1672eb718
BLAKE2b-256 checksum
How to use checksums
3d5d128b9dce07944833367a4dc5e24f7f5188db06167175463d0a14a8b63292
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

Download URL domainforge-0.22.1-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
58fb61be85ddb490dd7b99271e81b3c5da6eed69f91e4fe37666130e86c3e55e
BLAKE2b-256 checksum
How to use checksums
908be9cba822d7bdec9e2002f0d809623a61cc101c6b3e4218c3041b9d333405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

Security for domainforge 0.22.1

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