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.10.0.tar.gz (272.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.10.0-cp311-cp311-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.11Windows x86-64

sea_dsl-0.10.0-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.10.0-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.10.0-cp311-cp311-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

sea_dsl-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for sea_dsl-0.10.0.tar.gz
Algorithm Hash digest
SHA256 89c3deb1bc72c8c5e5fee1f9c4d16ab05e72cd2644f9b8b0af42129c2c545f1a
MD5 6f0002bddd45753fab2cdca5d43303c4
BLAKE2b-256 3fc1ec0d2847156275013907c745b7da157a12017973f50f885fd95d186895b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.10.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 21c7fc746c96626f8bbd9f52cdb75a1408b65822d60ec533d392d2dd955d5572
MD5 9ffd590596a6a2dce113e06c1b27fd0a
BLAKE2b-256 972686b6c45492b511d34e2c6b50fd0a4665e21739ca9680e01702c826ee3318

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.10.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6bea25219e2060e061d7979eaa46c4bd71c3877882a6016f104d777354da7ce4
MD5 3f5607aad45a8c1a11c9e526a66680d7
BLAKE2b-256 513efca857787e606ff4f756c0636d6fe256de872aac4f9a6651cf0b649d8c22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 27b95ae56804ce7ff8913e9db0513bf344995eaac670b2bb5ec6b1bb87f453cf
MD5 eb5128c13dddf6a857d4c25913bf5ccc
BLAKE2b-256 e108769817e8e3599a12a6139a9ae1824581053414738b9ce3ca149065918fa2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.10.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5737ef35779f04f8ef14343bce39aee90c5fa69e27e58fd8ff0c7ea4c3ca60f
MD5 664ee88a1b41446e13ba19eb9abeaab2
BLAKE2b-256 5a3f4fbc6d0eaf81926307e93df105cc8e042e6f9084281263f7068a4e85a07d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3e6a98654d1aa4d258b0feb300341b10b4ec8be679075c83f67da10a777a2cad
MD5 d459904109ba423899c29d52c5bede56
BLAKE2b-256 49de3bda2994c51e008637e2c9ea2c948059b581edf67a8bf918291475d23f29

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