Skip to main content

non-deterministic state machine specification to knead workflows

Project description

flowr — non-deterministic state machine specification to knead workflows

flowr

⚠️ Beta — do not install. This project is under active development with breaking changes in progress. The API, package structure, and configuration may change without notice until the first stable release.

Non-deterministic state machine specification to knead workflows.

flowr is a Python library and CLI for defining, validating, and visualising workflow state machines in YAML. Define your flows in a declarative format, validate them against the specification, query states and transitions, and export Mermaid diagrams — all from the terminal or programmatically.

Install

pip install flowr

Requires Python 3.13+.

Quick Start

Create a flow definition YAML file:

flow: deploy
version: 1.0.0
exits: [deployed, failed]

states:
  - id: prepare
    next:
      ready: execute

  - id: execute
    next:
      success: deployed
      error: failed

  - id: review
    next:
      approve:
        to: deployed
        when: { score: ">=80" }
      reject: failed

Validate it:

$ flowr validate deploy.yaml
valid: True

Query states and transitions:

$ flowr states deploy.yaml
prepare
execute
review

$ flowr next deploy.yaml review
state: review
next: approve (guarded)
next: reject

$ flowr transition deploy.yaml review approve --evidence score=85
from: review
trigger: approve
to: deployed

Export as Mermaid:

$ flowr mermaid deploy.yaml
stateDiagram-v2
    state "prepare" as prepare
    state "execute" as execute
    state "review" as review
    ...

CLI Reference

Command Description
flowr validate <file> Validate a flow definition
flowr states <file> List all state ids
flowr check <file> <state> [<target>] Show state details or transition conditions
flowr next <file> <state> [--evidence K=V] Show valid next transitions
flowr transition <file> <state> <trigger> [--evidence K=V] Compute next state
flowr mermaid <file> Export as Mermaid state diagram

All commands accept --json for machine-readable output.

Evidence can be passed with --evidence key=value (repeatable) or --evidence-json '{"key": "value"}'.

Documentation

Development

# Install with dev dependencies
uv sync --all-extras

# Run tests
uv run task test

# Fast tests (skip slow)
uv run task test-fast

# Full test suite with coverage
uv run task test-build

# Lint and format
uv run task lint

# Type checking
uv run task static-check

License

MIT

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

flowr-0.2.20260427.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

flowr-0.2.20260427-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file flowr-0.2.20260427.tar.gz.

File metadata

  • Download URL: flowr-0.2.20260427.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flowr-0.2.20260427.tar.gz
Algorithm Hash digest
SHA256 b428b2e71251a19f093ad1636e64244af5393d28d39bac08c3527502732294aa
MD5 b73bd3b6f10d9064a7b67a014aa3e70d
BLAKE2b-256 88606ee04c6eaceeed5039c2908cc789f85e0cdf5760d00eed9971a7c0150f50

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowr-0.2.20260427.tar.gz:

Publisher: pypi-publish.yml on nullhack/flowr

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

File details

Details for the file flowr-0.2.20260427-py3-none-any.whl.

File metadata

  • Download URL: flowr-0.2.20260427-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flowr-0.2.20260427-py3-none-any.whl
Algorithm Hash digest
SHA256 2ff9c34cb76791d2af543a58490c7be022aaa7f95ff9850ff0560bbadb9a98f8
MD5 447367691ee3fe6dc2f1023c4b0bc0c5
BLAKE2b-256 7a7d444be3d023acd665787efd24607a466c472149f6876836efbe60f41e857d

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowr-0.2.20260427-py3-none-any.whl:

Publisher: pypi-publish.yml on nullhack/flowr

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