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.3

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.3
File Size Uploaded Provenance Actions
flow_semantics-0.1.3.tar.gz 45.7 kB With provenance Details for flow_semantics-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 106.7 kB

Release files / flow_semantics-0.1.3.tar.gz

Download URL flow_semantics-0.1.3.tar.gz
Size 45.7 kB
Tags Source
SHA-256 checksum
How to use checksums
43b5ddfe7888a01a7cbb770b802ec40dd0a2935d262dc7c1d1ba6244ae79ecfa
BLAKE2b-256 checksum
How to use checksums
09cba724501b5b0846993c4dc4dd4d25a81b460df4a75d9c6392ddf42a5adccc
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.3-py3-none-any.whl

Download URL flow_semantics-0.1.3-py3-none-any.whl
Size 61.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be8a3632c5a85e292841fab983de195d34c3bdd8ef33d55a2a4acfea2440ec6c
BLAKE2b-256 checksum
How to use checksums
948377fc539d0ca86b007ec6658ea80986c9a992c7bcd1421901bb7cde876bf9
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.3

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.3.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