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.19.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.19.0
File Size Uploaded Provenance
domainforge-0.19.0.tar.gz 715.3 kB Without provenance Details

Built distributions (wheels)

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

Total release size: 29.5 MB

Release files / domainforge-0.19.0.tar.gz

Download URL domainforge-0.19.0.tar.gz
Size 715.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d3772ef9b250f3d063b19f91f9fffa6745bde1e1bbf196af6088b769bdcb27bd
BLAKE2b-256 checksum
How to use checksums
c08f07dbc062edaf2de65189e4cee88de30175aed90f721a46b4dd0024d91df9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

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

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

Download URL domainforge-0.19.0-cp313-cp313-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ede1c8236db3559226c524c4fa0e0b99be198906a5fc4551f74f961a32a65031
BLAKE2b-256 checksum
How to use checksums
1615f58daf293681bf6c3cc99ad90c3eec79712e6a4b3770217a82fee52a7ada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

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

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

Download URL domainforge-0.19.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0c0f6267b42df39c639d65d05ecb82b608e7fd68aeb52934fb71d328b38e914b
BLAKE2b-256 checksum
How to use checksums
1197e5cb712f2d8a16bba1dac441419d06d793c78f6be0f16ce695e1ae7168ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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

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

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

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

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

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

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

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

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

Download URL domainforge-0.19.0-cp311-cp311-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
90339b1dec30bbb74adae45bbf42952627c038d267996d3356e08c6569ae9045
BLAKE2b-256 checksum
How to use checksums
cebd4ae0ce67f894e42209baf139c2464c679bf92d48ab7c6148d6190e876324
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.1

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