Skip to main content

Validator for Object-flow Programming Language workflows.

Project description

ofplang validate

CI PyPI

A validator for Object-flow Programming Language v0 — a YAML-based dataflow workflow IR with linear Object tracking. The language is defined in the ofplang/spec repository.

The validator checks that a document is well-formed portable v0: structure and types, the feature model, linear Object tracking, structured nodes, contracts, and scheduling policies. It reports findings as stable error codes rather than free text, so results are easy to consume in tests and tooling.

Install

pip install ofplang-validate

Requires Python 3.10+. The only runtime dependency is PyYAML. For development, install editable with the test extra from a clone:

pip install -e ".[test]"

Command line

ofp-validate <file>...                 # or: python -m ofplang.validate <file>...
ofp-validate --mode extension-tolerant doc.yaml
ofp-validate --format json doc.yaml

Options: --mode {strict,extension-tolerant}, --format {text,json}, -q/--quiet, --no-color.

Exit codes: 0 all valid, 1 validation errors found, 2 usage/input error.

$ ofp-validate workflow.yaml
workflow.yaml:7:15: error unknown_type  processes.main.inputs.x.type  unknown type in 'Foo'
1 error in 1 of 1 file

Diagnostics carry a file:line:col source position (an imported fragment's own file when the problem is inside an $import); --format json includes file/line/col fields.

This tool is also intended to be exposed as the validate subcommand of the umbrella ofp CLI (a separate repository in the ofplang organization).

Library

from ofplang.validate import validate

result = validate("workflow.yaml", mode="strict")
if not result.ok:
    for d in result.diagnostics:
        print(d.code, d.path, d.message)

validate(source, *, mode="strict") returns a ValidationResult with .ok and .diagnostics (each a Diagnostic(code, message, path, file, line, col)). The validator collects all independent findings rather than stopping at the first; only a YAML parse or $import resolution failure is terminal.

The package lives under the ofplang PEP 420 namespace (ofplang.validate), shared across the organization's tools.

Scope

Covers graph-time validation of portable v0. Runtime failures, and run/data-phase preflight checks, are out of scope (spec §6.2, §25). Two modes are supported: strict (portable v0) and extension-tolerant (accepts x- extension keys).

Tests

The behavior is pinned by a spec-derived conformance suite that matches on error codes (see tests/conformance/README.md).

pytest                         # run everything
OFPLANG_STRICT_TESTS=1 pytest  # full contract, no pending escapes

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

ofplang_validate-0.1.1.tar.gz (96.9 kB view details)

Uploaded Source

Built Distribution

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

ofplang_validate-0.1.1-py3-none-any.whl (73.1 kB view details)

Uploaded Python 3

File details

Details for the file ofplang_validate-0.1.1.tar.gz.

File metadata

  • Download URL: ofplang_validate-0.1.1.tar.gz
  • Upload date:
  • Size: 96.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ofplang_validate-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5ce2c039c1db448450ea88ee556f80dc1d93e9af1b3ae0dedeccb1e307affcbd
MD5 f08cfe550cacdc86b3fed677c7273f7f
BLAKE2b-256 ac124705b19251b6ade4b4e55f56788a15c6352d96f5ef25c4bf9e2c687e8cce

See more details on using hashes here.

Provenance

The following attestation bundles were made for ofplang_validate-0.1.1.tar.gz:

Publisher: publish.yml on ofplang/validate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ofplang_validate-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ofplang_validate-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ea9b2577a7457acfbdcaf07bd599cca741184642df88a75fb48b1d07aa1e4ae
MD5 e110b0b108d7a517657e3f2a9c71b145
BLAKE2b-256 4406fc8a295354ce075aa7901f6fe21b6737cf0bf0faa778c6db94cb46428141

See more details on using hashes here.

Provenance

The following attestation bundles were made for ofplang_validate-0.1.1-py3-none-any.whl:

Publisher: publish.yml on ofplang/validate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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