Skip to main content

flezha

The Flezha Python SDK — a poll host over flz_core, the runner kernel the Rust, Java, Node, Ruby, PHP, Elixir and Go SDKs also drive.

Support tier: tier 2, passes the full conformance run in CI exactly as tier 1 does, with every capability present, and is permanently supported; it is not yet run by the maintainer in a live deployment, so a defect specific to it is likely to be found by its users first.

The kernel owns transport, ordering, per-cell exclusivity, durability, retries, timers, credit, routing and steps runs. This package brings the authoring surface, the codec for user types, the threading host and idiomatic errors — and no kernel code.

import flezha


@flezha.tasklet(name="echo")
class Echo:
    def run(self, value: str, ctx: flezha.Ctx[None, str]) -> None:
        ctx.emit(value)


@flezha.relay("echo")
def echo_relay(c: flezha.ChannelBuilder) -> None:
    c.input("input", codec="text").into(Echo).output("out")


flezha.create_runner("default").register_factory(echo_relay).run()
  • One decorator, one settings tree. @flezha.relay declares every relay, over a channels body or, as the short form, one tasklet's body. Its keywords are the class settings: run ("flow", the default, or {"steps": {"each": "per_input", "on_failure": "keep_progress"}}), durable (False, "local", the default, or "remote", with sleep_after in milliseconds; by default a flow never sleeps and a steps class sleeps after six hours, and with keep_finished: a finished instance keeps nothing unless it gives hours, or True for the controller's window, FLEZHA_STEPS_RETENTION_HOURS, 72 by default, so flz relay info can still show its Cells and result), max_duration_ms and description. The core refuses a setting under a parent that does not carry it, naming both.
  • Preview an output while it is produced. ctx.part(value) sends a listener a preview of the tasklet's output while run is still working; an output never sees it.
  • The GIL bounds only handler bodies. Every blocking core call releases it, so transport, framing, durability, retries, credit, routing and the activation decode all run in parallel in Rust.
  • Typed end to end, shipping py.typed: a wrong edge is a type-checker error before it is a registration error.
  • A channel names its payload format. codec= on input and output takes "bytes", "text", "json" or "msgpack". With none, an entry reads JSON and an output sends bytes unchanged, a string as UTF-8 and anything else as JSON, so an output needs no codec for a string, bytes or a JSON value.
  • Never pickle. Durable state is MessagePack from author-declared dataclasses, Pydantic models or attrs classes.
  • One error type. Anything Flezha refuses raises flezha.FlezhaError: a program branches on its code (such as topology.duplicate_factory_id or relay.already_running) or class_, and reads its message, details and hint.

Install

pip install flezha

flezha 0.1.0 is not on PyPI yet. Until it is, build a wheel from a checkout as examples/echo shows. Optional extras: flezha[pydantic], flezha[attrs], flezha[uvloop]; the SDK imports none of them unconditionally.

Supported Python versions

Python 3.11 or newer, CPython only. The native module needs the CPython C API, so PyPy and GraalPy are out of scope.

Two wheel tiers ship from one source, with one API and one set of semantics:

Tier Wheels What it is for
Compatibility one abi3 wheel per platform, targeting 3.11 every supported interpreter at or above the floor
Performance per-version free-threaded wheels, from cp314t handler bodies that execute in parallel

abi3 has no free-threaded form before CPython 3.15's abi3t, which is why the performance tier is per version. It starts at 3.14t, because PyO3 refuses the free-threaded build of CPython below 3.14. The runner names its tier in its startup line.

The native library

A prebuilt wheel carries the native module, flezha.flz_core_ffi, so installing needs no Rust toolchain. A platform with no prebuilt wheel falls back to the source distribution, which needs a stable Rust toolchain and fetches the core at the git tag native/Cargo.toml names.

Local mode, testing and the relay API

  • Local mode: LocalRelay.start runs a relay's declared graph in your own process, with no controller. See Local mode.
  • Testing: flezha.testing.TaskletTestHarness drives one tasklet and checks its replay. See Check a tasklet on its own.
  • The relay API: a relay's entry channels, answering a caller, call(...) to another relay, and runner.send and runner.call from application code. See Sending and calling.

Full documentation: the Python SDK guide.

Licensed under Apache-2.0.

Metadata

Release files for flezha 0.1.0

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

Built distributions (wheels)

Table of built distributions (wheels) for flezha 0.1.0
File Actions
flezha-0.1.0-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details for flezha-0.1.0-cp314-cp314t-win_amd64.whl
flezha-0.1.0-cp314-cp314t-manylinux_2_34_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.34+ x86-64 Details for flezha-0.1.0-cp314-cp314t-manylinux_2_34_x86_64.whl
flezha-0.1.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64 Details for flezha-0.1.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
flezha-0.1.0-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details for flezha-0.1.0-cp314-cp314t-macosx_11_0_arm64.whl
flezha-0.1.0-cp314-cp314t-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 free-threading macOS 10.12+ x86-64 Details for flezha-0.1.0-cp314-cp314t-macosx_10_12_x86_64.whl
flezha-0.1.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for flezha-0.1.0-cp311-abi3-win_amd64.whl
flezha-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl CPython 3.11 abi3 Linux glibc 2.34+ x86-64 Details for flezha-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl
flezha-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for flezha-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
flezha-0.1.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for flezha-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
flezha-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for flezha-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 32.5 MB

Release files / flezha-0.1.0-cp314-cp314t-win_amd64.whl

Download URL flezha-0.1.0-cp314-cp314t-win_amd64.whl
Size 2.7 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
6fba1b99978dbc03961aa28883b63722b3688adc67664e7f25ad16c1947631c6
BLAKE2b-256 checksum
How to use checksums
00a137a63884b2fecb9639921f4865cc7def80c08997f20be0aa375a872e537d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / flezha-0.1.0-cp314-cp314t-manylinux_2_34_x86_64.whl

Download URL flezha-0.1.0-cp314-cp314t-manylinux_2_34_x86_64.whl
Size 3.1 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
994d706cff376b7c8473078b0172c20205a0bd78cb6b8985ecb9ed4aa4d427e0
BLAKE2b-256 checksum
How to use checksums
79ef8d01c12d870fbc141df26fb553da21b48cadd6782cc834d0bb43b207b145
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / flezha-0.1.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL flezha-0.1.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 2.7 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
ba1e643c9f3e3fdc17ea3920ac70eed0366c488b4084d6e7cff55f42b9fb47f0
BLAKE2b-256 checksum
How to use checksums
6bc9b677eafac8b499bf8f0d6e1f93861fc20687a9f167c96841b803f5cec698
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / flezha-0.1.0-cp314-cp314t-macosx_11_0_arm64.whl

Download URL flezha-0.1.0-cp314-cp314t-macosx_11_0_arm64.whl
Size 3.8 MB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a0cc7743186659414a85c2b6e3a0ad926eaee5637984e1e5a9ed80c15961376a
BLAKE2b-256 checksum
How to use checksums
d012a2a1ec3b88db9a916e7b1f9d88682c2d9c1488b301db718e17fd61e39f1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / flezha-0.1.0-cp314-cp314t-macosx_10_12_x86_64.whl

Download URL flezha-0.1.0-cp314-cp314t-macosx_10_12_x86_64.whl
Size 3.9 MB
Tags CPython 3.14 CPython 3.14 free-threading macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e3f114347fee0ebcaeb80992df9b6ca74f9c6115668cd4bdb05160da00abebcd
BLAKE2b-256 checksum
How to use checksums
316c5f50ccd72f725ccbdd096ff26d960c1cc04286bd786ade348c853bf1e23f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / flezha-0.1.0-cp311-abi3-win_amd64.whl

Download URL flezha-0.1.0-cp311-abi3-win_amd64.whl
Size 2.7 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e1bc93343a31cc4da4a6bf5382cd3a6aa33b6b5e197623e4212f31cd45af2e5d
BLAKE2b-256 checksum
How to use checksums
45c2b6c0c3d4228b87e2daaa586a6513d39dc12cfdb723552031e246a32a2361
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / flezha-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl

Download URL flezha-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl
Size 3.1 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
17fec9f4f86eb5b08d61461cb52697b3e8b3d8ea67720097a1ad11d9e2ab6709
BLAKE2b-256 checksum
How to use checksums
69a91c7f9b46713dfadf26c60d288c93ec8b8c25d36d4704dbacabb7120f5bc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / flezha-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL flezha-0.1.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 2.7 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e1fe15bf686c5544c3badce72dadc485e23c74fec0d040fd88420e49f6fec4a6
BLAKE2b-256 checksum
How to use checksums
4cf5a1b288343b6bf85c1d36ef48cd276b5c72c60e5302a911ec200f6b9c9d10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / flezha-0.1.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL flezha-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Size 3.8 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2ac83cf32b0edaaa4e57f8ea070946e49205755c1d9dbb8cd208cb9079e6223b
BLAKE2b-256 checksum
How to use checksums
c7787e23393beac88b8d1ce9ea4a726dc76b44e95faec545e1fa466e11cd7731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / flezha-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL flezha-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 3.9 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6d621170ef0b853ed4f1e43bd614b5676827c35917446007f0913fe6dadb6ca0
BLAKE2b-256 checksum
How to use checksums
ddf32918a578f128a3ab1e01c71f5d498d5a82c83fe119724c44f627d7c38b12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for flezha 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

10 release files No provenance

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