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:
- Feature catalog — all 62 features
- Getting started — first flow
- Decision tables — hit policies
- Error handling — catch/rethrow/finally
- Finalization — guaranteed cleanup
- Tracing — traces and explain
- Replay & simulation
- Advanced features — merge, portability
- Versioning
- Framework integration
- Cookbook — recipes
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.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flow_semantics-0.1.4.tar.gz | 45.7 kB | With provenance | Details for flow_semantics-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flow_semantics-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for flow_semantics-0.1.4-py3-none-any.whl |
Total release size: 106.7 kB
Release files / flow_semantics-0.1.4.tar.gz
| Download URL | flow_semantics-0.1.4.tar.gz |
|---|---|
| Size | 45.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
399d1c2f2eedc17f0477e0653292fe643041b1d8679d641208426efc205e28e0
|
|
BLAKE2b-256 checksum How to use checksums |
2d42d9ac1bf481203fae2f4914e52a3eee92dc24704395a59f4f42ee4274225f
|
| 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 logRelease files / flow_semantics-0.1.4-py3-none-any.whl
| Download URL | flow_semantics-0.1.4-py3-none-any.whl |
|---|---|
| Size | 61.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4b4e3d69916b4956499b65bddf7e115b350bbfa960941077f313c24e7a20814
|
|
BLAKE2b-256 checksum How to use checksums |
7917cd2879b62619601ba0464efd7b3ec71cb85d55c94a7e440a6c1c2d557b87
|
| 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 logSecurity for flow-semantics 0.1.4
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.
Attestation for flow_semantics-0.1.4.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 logA 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.