Skip to main content

SEA DSL - Semantic Enterprise Architecture Domain Specific Language

Project description

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

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

License

Apache-2.0


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

sea_dsl-0.7.2.tar.gz (265.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sea_dsl-0.7.2-cp311-cp311-win_amd64.whl (991.5 kB view details)

Uploaded CPython 3.11Windows x86-64

sea_dsl-0.7.2-cp311-cp311-manylinux_2_34_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

sea_dsl-0.7.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

sea_dsl-0.7.2-cp311-cp311-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

sea_dsl-0.7.2-cp311-cp311-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file sea_dsl-0.7.2.tar.gz.

File metadata

  • Download URL: sea_dsl-0.7.2.tar.gz
  • Upload date:
  • Size: 265.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.1

File hashes

Hashes for sea_dsl-0.7.2.tar.gz
Algorithm Hash digest
SHA256 3ff39b8cc7298ce8eb35b15d8bbb6c0a74c946ba52de04e636de475880970bac
MD5 866be2b5bf232977f7c2ba61b0a0ff35
BLAKE2b-256 1913e8ebf945415e8aae51aed876b5662244774c0c0aeaaf1cfc19d2d67aa95e

See more details on using hashes here.

File details

Details for the file sea_dsl-0.7.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: sea_dsl-0.7.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 991.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.1

File hashes

Hashes for sea_dsl-0.7.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f0049358305844a4bd105473fc0cec9080c26c6f1f52441dafc5656f6c1874da
MD5 60dbcaf6611753c6e238d298d17ce510
BLAKE2b-256 ddf2f702230aec95bf00af1e5ae537136c5081b114a997bd1073d5f16e48f639

See more details on using hashes here.

File details

Details for the file sea_dsl-0.7.2-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for sea_dsl-0.7.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3dca9048f8a48ec60e4fa308a86a5a385285fc9f8b21735ba03decf5145c9d06
MD5 6ebec553caf2b598a06df25ac5ba6aeb
BLAKE2b-256 ae0a26062110e7d8bbd56daaeb80d0c537baee2903cfb67dadf8741cd40b9d74

See more details on using hashes here.

File details

Details for the file sea_dsl-0.7.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for sea_dsl-0.7.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 930a52cf6f22e22ddada723dd14b3cf01db1eafcc87ad273a9bc078355781edd
MD5 02d87218e9bc838dd95563b17db7c915
BLAKE2b-256 29be2565af7f0bfaf846a560fad8ae48b142820cffacbfd639f40913972ec07c

See more details on using hashes here.

File details

Details for the file sea_dsl-0.7.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sea_dsl-0.7.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf7e4b5bf2433bb02438c78f631f04ad65990329cc9e94f438068e8ebc0c9718
MD5 94e394ee5ab58d9612330a5a3edb049c
BLAKE2b-256 40e7f3df493a1f34679f7e692eaa0300cc6a8ff2c5db3ef7ec3038bb0aba5507

See more details on using hashes here.

File details

Details for the file sea_dsl-0.7.2-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for sea_dsl-0.7.2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 348a3472315969bb6de4af5fbb2db5567aa715809c616aafde3145ad9ad9bab9
MD5 25abd7cebaa598ba40a5bca71799c7b0
BLAKE2b-256 9884ef513c8d63921dce1016c1017c98310d97db94860136d87518b1fc169103

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page