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

Uploaded CPython 3.11Windows x86-64

sea_dsl-0.8.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.8.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.8.0-cp311-cp311-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

sea_dsl-0.8.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.8.0.tar.gz.

File metadata

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

File hashes

Hashes for sea_dsl-0.8.0.tar.gz
Algorithm Hash digest
SHA256 2b880620d97007b1955591f7e24d83da766ea3349b486285e1d8ddf1a2cfaf6b
MD5 6e4511ffa6b4e83aacbd725c1264f8aa
BLAKE2b-256 c9507822a3210ac8141a3b368c918212ae2ba1391ec0e36fc237d64d1c0bbf14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sea_dsl-0.8.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

Hashes for sea_dsl-0.8.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 45ee21aa844f5626110b7cff0646f4cd0828ede4b790ca8d47045a91241d2f89
MD5 8ecc5447ad98cebf64b73b9df9524c93
BLAKE2b-256 948527b87e8b02d2862dabe4764c735167959ebf66de11381ebea0697d383b63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.8.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8349e025d016fbe3d39fad1d86b44cadbaa1356ee2ce5bc8dba2dc976e744cf3
MD5 7881969e4bbfa5e56d037e9a9a06723b
BLAKE2b-256 1ba5d96bf05992383470538aca7927c7820502c0f442e0d06f24ec0d4f9e595a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 10aec96c589dd30428bb1d857f22ee5324db464f4a02f20de1b4e7f53c011e73
MD5 e24e6f76381af71175505ab1fa20e5c4
BLAKE2b-256 ef61243cf441d9d254f3f26f619bc63d5e6b3eb39ec40ebb8bc501de5c0b82cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.8.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f2d868d91f462bf1fce297c22c6b6fdb7debf7ad67e3eae397005d7ee023f80
MD5 04718f6477ca4c71690c62bf6ad8abaa
BLAKE2b-256 355a71a8f3eb13dc14b4bb1392256c233d82cf21d6d4e66edb1115dbb4bdb554

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.8.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fa93ade3881b6470df5def50a5488b33f512690af422d53e2b97dc96a4bfaf2f
MD5 9b795aca982c8d2de452e91132c3e235
BLAKE2b-256 a9a05bdbedc157a46f49e58d8306d767678f1e2c79af29c0c01d0c63fe197ab9

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