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.3.20260427.tar.gz (13.6 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.3.20260427-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flowr-0.3.20260427.tar.gz
Algorithm Hash digest
SHA256 5f98acfa1ff9494a2a6af6a84f7863c0b1285eb35d6471f4fc5aba2537ccdf39
MD5 946b49191055de3d072747300d9e151f
BLAKE2b-256 38e16e1050ef5b7eaeb390d7c1500c6930b91e5a389ef5be357e0f56002f8ca4

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowr-0.3.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.3.20260427-py3-none-any.whl.

File metadata

  • Download URL: flowr-0.3.20260427-py3-none-any.whl
  • Upload date:
  • Size: 13.8 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.3.20260427-py3-none-any.whl
Algorithm Hash digest
SHA256 a88bbf230e3492fc314108cb967dbd490313e8f4805150e83c017914378410e2
MD5 17016a36726af9ef3c8482bcb61df125
BLAKE2b-256 f46e1912d7364694209829838a62d44d4ab02517ef11d8e1db39e41b37938dd9

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowr-0.3.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