SEA DSL - Semantic Enterprise Architecture Domain Specific Language
Project description
SEA DSL
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
Installation
pip install sea-dsl
Requires: Python 3.9+
Quick Start
Parse from DSL
import sea_dsl
source = '''
@namespace "supply_chain"
Entity "Warehouse" in logistics
Entity "Factory" in manufacturing
Resource "Cameras" units
Flow "Cameras" from "Warehouse" to "Factory" quantity 100
'''
graph = sea_dsl.Graph.parse(source)
print(f"Entities: {graph.entity_count()}")
print(f"Resources: {graph.resource_count()}")
print(f"Flows: {graph.flow_count()}")
Build Programmatically
import sea_dsl
graph = sea_dsl.Graph()
# Create primitives
warehouse = sea_dsl.Entity("Warehouse", "logistics")
factory = sea_dsl.Entity("Factory", "manufacturing")
cameras = sea_dsl.Resource("Cameras", "units")
graph.add_entity(warehouse)
graph.add_entity(factory)
graph.add_resource(cameras)
# Create flow
flow = sea_dsl.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 = sea_dsl.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 = sea_dsl.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 = sea_dsl.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/
Using Just (Recommended)
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.
Related Packages
| Package | Registry | Description |
|---|---|---|
sea-core |
crates.io | Rust core library |
sea-dsl |
PyPI | Python bindings (this package) |
@domainforge/sea |
npm | TypeScript/Node.js bindings |
Documentation
- 📖 SEA DSL Guide — Language specification
- 🏗️ Architecture — Design overview
- 📚 API Reference — Full Python API
License
Part of the DomainForge project.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sea_dsl-0.9.0.tar.gz.
File metadata
- Download URL: sea_dsl-0.9.0.tar.gz
- Upload date:
- Size: 271.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93aba94968a2e3e64eab9b475c9530528c6f508cfa72e8abc3bf258929cef90c
|
|
| MD5 |
0ceeb882dc50338668ca9ba1c2dc3ef5
|
|
| BLAKE2b-256 |
957cfe70dfac68fe082331a158ae69295ff6e86d4807085b93a0b49a82634c12
|
File details
Details for the file sea_dsl-0.9.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: sea_dsl-0.9.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f638515a5578ac2647ebe9643bb1c7e4d37fc509fd50d5a8858081c5d0e3ec8
|
|
| MD5 |
04cbea7b3bbbd3a6abd8f9fea8e7fc3f
|
|
| BLAKE2b-256 |
d041bc4ad3297234373e9630a1517f1f549322f2e5f20460e38bad633bf7c1b2
|
File details
Details for the file sea_dsl-0.9.0-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: sea_dsl-0.9.0-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12527f7d9439141acdc3f362576899cc96ca9f5d2cfeb7f75d1469d1304d9145
|
|
| MD5 |
42178300bb4dbef76c94f7ca15c142fb
|
|
| BLAKE2b-256 |
a9c7b82e35ac25a6ad31f897e274d7a89797c172a3fb1c328b86369e6a3076ae
|
File details
Details for the file sea_dsl-0.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: sea_dsl-0.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a131f344595e164a797bd1eb5e2efa44da45175eba6c2d61f1fd16846d198a51
|
|
| MD5 |
fa06b47ed05aa9655c32b3c19fefefa3
|
|
| BLAKE2b-256 |
5b1000e14d479fabc55e2a9b36ffb1c4ef5a2380bd01671b240501e97d032592
|
File details
Details for the file sea_dsl-0.9.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: sea_dsl-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddf4cb320d720ab169987aa44bd01757fb61a28331b4ba6ed32d83bf02d23641
|
|
| MD5 |
5a3171ec59fe6229dcbbaff78f33bd26
|
|
| BLAKE2b-256 |
91b90ca583211ededda550155c6e7a0a1b19a1ade76b6da9db5cf9571aa257a5
|
File details
Details for the file sea_dsl-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: sea_dsl-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8fb280062c5dd70ab56b88fbbf338d12318e198b68058ebf0317ca938ebdd21
|
|
| MD5 |
e2613bfb74fa64228f64daa6f0e000ff
|
|
| BLAKE2b-256 |
da31b76e73867abe5009e80c762c810fc5137f4966b745a05b9f4b611c8bece6
|