Skip to main content

Assertions Mate

PyPI - Version PyPI - Python Version

assertions-mate validates CWL workflow inputs against assertion hints embedded in the workflow definition.

It adds policy and rule checks on top of CWL typing by supporting:

  • JSON Schema validation
  • Rego policy validation (OPA)
  • CQL2 expression validation

Documentation site: https://terradue.github.io/assertions-mate/

Documentation follows the Diataxis framework:

  • Tutorials: learning-oriented walkthroughs
  • How-to guides: task-focused recipes
  • Reference: technical contracts and interfaces
  • Explanation: design rationale and concepts

Why Use It

When a CWL workflow needs stricter runtime checks (business rules, policy constraints, geospatial conditions), assertions-mate lets you define them as workflow hints and evaluate them against an input payload before execution.

Installation

From source (recommended for development)

git clone https://github.com/Terradue/assertions-mate.git
cd assertions-mate
pip install -e .

Runtime requirements

  • Python >= 3.10
  • Dependencies are managed in pyproject.toml

Command Line Usage

After installation, run:

assertions-mate path/to/workflow.cwl --inputs path/to/inputs.yaml

What happens:

  1. The CWL document is loaded.
  2. Assertion hints are discovered from workflow.hints.
  3. Matching validators are built and executed against the input mapping.
  4. Validation issues are reported with pointer and detail messages.

Supported Assertion Hints

The tool maps eoap: hint classes to internal validators:

  • eoap:JSONSchemaHint
  • eoap:RegoPolicyHint
  • eoap:Cql2FilterHint

Example hints snippet

hints:
  - class: eoap:JSONSchemaHint
    json_schema:
      type: object
      required: [count]
      properties:
        count:
          type: integer
          minimum: 1

  - class: eoap:RegoPolicyHint
    module: |
      package workflow
      deny contains "count must be <= 10" if {
        input.count > 10
      }
    queries:
      - data.workflow.deny[_]

  - class: eoap:Cql2FilterHint
    queries:
      - id: cql-rule-1
        cql2: "count > 0"
        message: "count must be greater than zero"

Development

This project uses Hatch environments and pytest.

# Run tests
hatch run test:test-q

# Run formatting check
hatch run dev:lint

# Run lint checks with fixes
hatch run dev:check

If you use Taskfile:

task test
task lint
task check

Project Layout

  • src/assertions_mate/ core package and CLI
  • tests/ unit tests
  • schemas/ CWL hint schema definitions
  • docs/ notebooks and documentation sources

License

Apache License, Version 2.0

Download files

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

Source Distribution

assertions_mate-0.9.0.tar.gz (53.0 kB view details)

Uploaded Source

Built Distribution

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

assertions_mate-0.9.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file assertions_mate-0.9.0.tar.gz.

File metadata

  • Download URL: assertions_mate-0.9.0.tar.gz
  • Upload date:
  • Size: 53.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for assertions_mate-0.9.0.tar.gz
Algorithm Hash digest
SHA256 2525b88c854de8935a9d34e77f00a87818a490a0e51f25a17873811a28c9d9fc
MD5 9d6143189c2e2e50ded0c4678ecd841c
BLAKE2b-256 078dfd553f79e0e6555f9bbfa87cb8ec4d8236e57e4cca53665dcdde9de1e761

See more details on using hashes here.

Provenance

The following attestation bundles were made for assertions_mate-0.9.0.tar.gz:

Publisher: package.yaml on Terradue/assertions-mate

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

File details

Details for the file assertions_mate-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: assertions_mate-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for assertions_mate-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c589ee94071d7acba5b7f37b348ab0003eac2bc4e6a516e5b3a97f60e6a6e67
MD5 9d5b501abb5e6dc20258bc8de68b5c76
BLAKE2b-256 c7586d5420dcf257b07626c04864867f836f1fb2052f5e4acdbdfcbd111dcbd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for assertions_mate-0.9.0-py3-none-any.whl:

Publisher: package.yaml on Terradue/assertions-mate

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

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page