Skip to main content

oml-lang

Parse, validate, and transpile Orchestra pipeline definitions from Python.

oml-lang is the Python binding for the Orchestra pipeline DSL — the same engine that powers the Orchestra VS Code extension. It ships the dialect's schema and validators as a native library, so you get full dialect-aware parsing and validation without calling out to a separate process.

About the dialect

Orchestra pipelines are authored in a KSON-based DSL for defining, validating, and shipping data pipelines. A pipeline describes tasks, dependencies, conditions, triggers, and variables across 95+ integrations (Snowflake, dbt, Fivetran, Databricks, and more).

A minimal pipeline looks like this:

version: v1
name: 'task-references'
pipeline:
  producer:
    integration: SNOWFLAKE
    integrationJob: SNOWFLAKE_RUN_QUERY
    parameters:
      set_outputs: true
      statement: 'SELECT 1'
      .
    .
  consumer:
    integration: SNOWFLAKE
    integrationJob: SNOWFLAKE_RUN_QUERY
    condition: "${{ tasks['producer'].status == 'SUCCEEDED' }}"
    parameters:
      statement: "SELECT ${{ tasks['producer'].outputs['count'] }}"
      .
    dependsOn:
      - producer

The dialect validates required fields and types, integration-specific parameters, variable references and expressions, task dependencies, cron syntax, and branching conditions. See the Orchestra documentation for the full language reference.

Installation

pip install oml-lang

API

The module exposes five top-level functions and return the raw result objects.

analyze(kson: str) -> Analysis

Statically analyze an Orchestra document. The bundled engine runs the Orchestra dialect validators automatically, so analyze catches parse errors, schema violations, expression syntax errors, bad task references, circular dependencies, invalid cron expressions, and so on.

import oml_lang

src = open("pipeline.oml").read()
analysis = oml_lang.analyze(src)

for msg in analysis.errors():
  start = msg.start()
  print(f"[{msg.severity()}] {start.line()}:{start.column()}  {msg.message()}")

Example output for a pipeline with a broken condition expression and missing required fields:

[MessageSeverity.ERROR] 3:53  Expression syntax error: Expected RPAREN but got ''
[MessageSeverity.WARNING] 0:0  Missing required properties: version, name

The Analysis object

Analysis exposes three views of the analyzed document:

  • errors() -> list[Message] — every error and warning produced by the parser, schema validator, and dialect validators. Each Message carries a severity() (MessageSeverity.ERROR or MessageSeverity.WARNING), a message() string, and start() / end() Positions whose line() and column() methods return zero-based offsets. An empty list means the document is valid.

  • tokens() -> list[Token] — the full lexed token stream, useful for syntax highlighting and editor tooling. Each Token has token_type() (a TokenType enum), text(), and start() / end() positions.

  • kson_value() -> KsonValue | None — the parsed document as a typed value tree, or None if parsing failed fatally. Call type() to get a KsonValueType discriminator, or isinstance check against KsonValue.KsonObject, KsonValue.KsonArray, KsonValue.KsonString, KsonValue.KsonNumber, KsonValue.KsonBoolean, KsonValue.KsonNull, or KsonValue.KsonEmbed to walk the tree.

from oml_lang import analyze, KsonValue

analysis = analyze(src)
root = analysis.kson_value()
if isinstance(root, KsonValue.KsonObject):
  # ... walk the object
  ...

to_json(kson: str, options: TranspileOptions.Json) -> Result

Transpile Orchestra source to JSON. Returns a Result — pattern-match on Result.Success / Result.Failure:

from oml_lang import to_json, Result, TranspileOptions

result = to_json(src, TranspileOptions.Json(retain_embed_tags=False))
if isinstance(result, Result.Success):
  print(result.output())
else:
  for err in result.errors():
    print(err.message())

to_yaml(kson: str, options: TranspileOptions.Yaml) -> Result

Same shape as to_json, but emits YAML and preserves comments.

from oml_lang import to_yaml, TranspileOptions

result = to_yaml(src, TranspileOptions.Yaml(retain_embed_tags=False))

format(kson: str, format_options: FormatOptions) -> str

Pretty-print Orchestra source with the given formatting options. Applies the dialect's embed-block rules but not its validators, so this is lossless reformatting, not validation — run analyze to validate.

import oml_lang
from oml_lang import FormatOptions, FormattingStyle, IndentType

formatted = oml_lang.format(
  src,
  FormatOptions(
    indent_type=IndentType.Spaces(2),
    formatting_style=FormattingStyle.PLAIN,
    embed_block_rules=[],
  ),
)

parse_schema(schema_kson: str) -> SchemaResult

Parse a KSON JSON-Schema document and, on success, return a reusable SchemaValidator.

from oml_lang import parse_schema, SchemaResult

result = parse_schema(open("my.schema.kson").read())
if isinstance(result, SchemaResult.Success):
  validator = result.schema_validator()
  messages = validator.validate(src, "document.oml")

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

orchestra_lang-0.2.1-cp310-abi3-win_amd64.whl (19.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

orchestra_lang-0.2.1-cp310-abi3-manylinux_2_34_x86_64.whl (20.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

orchestra_lang-0.2.1-cp310-abi3-manylinux_2_34_aarch64.whl (20.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ ARM64

orchestra_lang-0.2.1-cp310-abi3-macosx_11_0_arm64.whl (18.8 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file orchestra_lang-0.2.1-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for orchestra_lang-0.2.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 273301c93a627eb912812d73cb810569f37332af34462d5d4e593efa6ce3dc63
MD5 23aeb85c374ff565df70f3ebd80cbfb8
BLAKE2b-256 9723b8376d20321f027c74c76f2bb48b4e1bdb95fef34e8f3f260403570caafd

See more details on using hashes here.

File details

Details for the file orchestra_lang-0.2.1-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for orchestra_lang-0.2.1-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bdf12c492f4c6ebd70b10321061e7d43ddb3da77959d88362ab1838c88376a34
MD5 b66e19ebf87558c3fec562bcf3187ba4
BLAKE2b-256 a429bad9e7019ce3015d2f37af498cff4128b504b754c517e6e7ed349fa9cd47

See more details on using hashes here.

File details

Details for the file orchestra_lang-0.2.1-cp310-abi3-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for orchestra_lang-0.2.1-cp310-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 4d247622f953772c5207c1fa49a6669dd99f80cb210cc833282a594144ade7e1
MD5 7c725cd67249912a742b2134ea0e8bb9
BLAKE2b-256 fa8783a01d8266875758966536cd4d7efe63c0417e6db21b237af54684d4d954

See more details on using hashes here.

File details

Details for the file orchestra_lang-0.2.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for orchestra_lang-0.2.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a465f2ac3bf7d429a468829ec3507018392cb3eef5e3f03eb6eeb321feccba62
MD5 804ccac5e2f54d3be353fbad58194f19
BLAKE2b-256 34f6d065c123003e3aa023030be4535bba50c412b5a8bf0724781b6a95713ac7

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