Skip to main content

flow-semantics (Python)

FlowSemantics expresses the decision, error-recovery, guaranteed-cleanup, and interruption-accounting portions of complex application logic as a traceable, testable, portable pipeline — with zero runtime dependencies (standard library only).

Repository: github.com/sancy1/flowsemantics

Documentation: sancy1.github.io/flowsemantics — guides, feature catalog, and API reference

What it does

FlowSemantics turns complex decision-and-error logic into a compiled, inspectable contract: conditions, actions, typed exception recovery, guaranteed cleanup (finally), cancellation/timeout accounting, proposed side effects, structured traces, and deterministic replay/simulation — all versioned and portable across five languages (Python, TypeScript, Go, Java, C#) from one normative spec (SPEC.md).

Quick start

from flowsemantics import Flow

contract = (
    Flow()
    .when(lambda o: o["total"] > 100, then=lambda o: "approved", id="large")
    .when_not(lambda o: o["total"] > 100, then=lambda o: "rejected", id="small")
    .compile()
)

outcome = contract.try_execute({"total": 250})
outcome.execution_status  # ExecutionStatus.COMPLETED
outcome.decision_status   # DecisionStatus.APPROVED
outcome.value             # 'approved'

compile() validates the flow once; try_execute() always returns a FlowOutcome (never raises unrecovered exceptions — use execute() when you want them raised). Full walkthrough: getting-started (in all five languages).

Feature documentation

The language-neutral feature guides live in the repository documentation:

The normative specification is SPEC.md.

Package identity

Purpose Name
PyPI distribution flow-semantics
Python import flowsemantics
Minimum Python 3.11

Dependencies

Runtime dependencies: zero third-party. Standard library only. Enforced by the repository audit.

Build dependencies: hatchling (declared in pyproject.toml).

Development dependencies: ruff, mypy, pytest, pytest-asyncio, uv, sphinx (declared in pyproject.toml under [dependency-groups].dev; not shipped).

API documentation (auto-generated HTML)

Published: https://sancy1.github.io/flowsemantics/python/

Docstrings are the single source of truth; Sphinx renders them to HTML, mirroring the C# XML file, Java Javadoc, and Go godoc output.

python -m sphinx.ext.apidoc -o docs -f src/flowsemantics   # regenerate module stubs
python -m sphinx -b html docs docs/_build/html             # build HTML

Output: docs/_build/html/index.html.

Installation (consumer path is pip)

pip install flow-semantics

Local development

See the root CONTRIBUTING.md for the tooling, the packaging rules, and the pull request checklist.

Metadata

Release files for flow-semantics 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flow-semantics 0.1.5
File Size Uploaded Provenance Actions
flow_semantics-0.1.5.tar.gz 45.8 kB With provenance Details for flow_semantics-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flow-semantics 0.1.5
File Interpreter ABI Platform Actions
flow_semantics-0.1.5-py3-none-any.whl Python 3 none any Details for flow_semantics-0.1.5-py3-none-any.whl

Total release size: 106.7 kB

Release files / flow_semantics-0.1.5.tar.gz

Download URL flow_semantics-0.1.5.tar.gz
Size 45.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d830d1514ffcb1a0b17fba852c7243999a7fcc26a164db67ac432e5bb1e61b2f
BLAKE2b-256 checksum
How to use checksums
e44712de37ad2b6b02ec5cf54ec75258f05a7167f28c97d3375d7a6321aa7912
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / flow_semantics-0.1.5-py3-none-any.whl

Download URL flow_semantics-0.1.5-py3-none-any.whl
Size 61.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef5d1272f4b5189c75f92635db224b1785e4997d8a4b19a9544e29fb4a7dc67f
BLAKE2b-256 checksum
How to use checksums
1a3dd7584bd455dfa9ea7b96a0d3e03c2c16aef616858d4b3df8daf19b483ef4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for flow-semantics 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for flow_semantics-0.1.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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