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.3.tar.gz (266.6 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.3-cp311-cp311-win_amd64.whl (991.7 kB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

sea_dsl-0.7.3-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.3.tar.gz.

File metadata

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

File hashes

Hashes for sea_dsl-0.7.3.tar.gz
Algorithm Hash digest
SHA256 c6d656b635f0380f3939accb974978b1869f297904bf02e232cf92236252fb0e
MD5 1362e75db2a8a9b5079d7a34c7e11067
BLAKE2b-256 2e930de95a10e5799a8b020465dd2053399a7eeb565528384e9cf097ff571319

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sea_dsl-0.7.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 991.7 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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5d978e9e68ce8b0b6acd9d040e67488f51a170830b83fbaaa7ea8aa0669a91e9
MD5 efc4d61376318184066f0145e7c09341
BLAKE2b-256 8454332bfed3c76a73e2eafa72b6108f47f0fd16835475270881b77e3d3569e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.7.3-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9a1565f3a7ac047daeb66624afb9efbba9e6f677569320e8baa4d0ba957c57ea
MD5 7f2ac8e53315e73593cb996a2bebd1c9
BLAKE2b-256 723288c4fdd96287e1045ef1abdbf3f0693c643e7bc195829807a48233b141f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.7.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d9e2d31076c53ef1e5e08471794dd69fe9ef8e1f0d70ea0a68f5faa4857d87fa
MD5 6a29e48f17b35185396b81dece955c96
BLAKE2b-256 16269186cb2b0f52b2f7348f964bdc765a7f85884d6fc2e9282b8633de0818d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.7.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1cb0a22dcad74e4b14655ed04249036a98144044b5bf7c8fd741849fbff4361
MD5 b6cf0d81221a09a9560d09ae9eeed238
BLAKE2b-256 553309c44336ef58c1327910d6ba97adb8d3e206c6b42723972d61acc24a63fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sea_dsl-0.7.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 448eb6de015aa82e9dee4d9ab69d146cdb0133fd3993cc8c1bfd9a42c1c60400
MD5 d71bb2e8eb93311f1db552d4dc53156c
BLAKE2b-256 7e59d20221dfbb79d2d6fd06737edaff5c2840705b08c4d6d2df4a7996b432cb

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