Skip to main content

Calc Flow

Linux CI Windows CI Scheduled Benchmarks Codacy Grade Coverage Status

Calc Flow is a Python calculation library for Arrow tables and stateful streams. Compose typed expressions, SQL, and reusable Python functions in one pipeline. Collect a dataset or iterate its results as data arrives. Rust provides the internal runtime: DataFusion table execution, graph compilation, state, checkpoints, and recovery. Calc Flow Studio is a separate local FastAPI and React application.

Install

CPython 3.9 or newer:

uv add calc-flow-python

Optional array providers:

uv add "calc-flow-python[numpy]"
uv add "calc-flow-python[jax]"

Python quickstart

import pyarrow as pa
import calc_flow as cf

data = pa.table({"a": [1, 3], "b": [2, 4]})
result = cf.compute(data, lambda t: t.select(total=t["a"] + t["b"]))
assert result.to_pydict() == {"total": [3, 7]}

cf.compute infers the supported Arrow schema and returns a pyarrow.Table. The builder receives a TableExpr; indexing selects columns, operators compose calculations, and select, with_columns, and filter return new declarations. Use await cf.compute_async(...) in an event loop.

Add a read-only SQL stage with t.sql(query), using the local alias input. Use cf.sql(query, orders=orders, fees=fees) for explicit named table declarations. SQL returns another TableExpr, so pipe, column operators, and table methods compose before and after it. expression.pipe(function, *args, **kwargs) calls an ordinary synchronous function once while building the calculation.

For streams, use async with output.stream(batches()) as results, then async for table in results. One native job retains state across batches and owns cleanup. Declared event-time inputs default to validated nondecreasing timestamps and watermarks that produce finalized results before EOF. Use watermarks for explicit disorder or source-provided progress; see watermark policies. A Program yields named StreamOutput events for multiple outputs. The convenience stream uses temporary checkpoints and best-effort iterable delivery; durable recovery uses explicit source/sink bindings and a managed checkpoint root.

Continue with SQL and reusable pipelines and the first streaming pipeline. The runnable examples cover SQL composition, stateful streaming, and named streaming outputs. The connector examples cover all seven transports and every supported read/write direction, with service setup and output checks. The default wheel includes file; other transports require native build features. Expression workflows cover financial features, recovery, static matrices, and joins. Use explicit Runtime, plans, Batch, UDFs, and PipelineBuilder for runtime integrations and diagnostics.

The Rust runtime reference and native examples cover implementation and extension work. The calc-flow crate's exports remain available to those users.

Architecture

crates/calc-flow  (Rust core: Batch, graph compiler, DataFusion, runners, stores)
  ├─ crates/calc-flow-connectors  (trusted transport implementations)
  └─ crates/calc-flow-python  (PyO3 _native binding + registered connectors)
       └─ python/calc_flow  (Python expressions, Arrow execution + integrations)
            └─ web-ui/backend  (calc-flow-studio FastAPI, /api/v3, loopback only)
                  └─ web-ui/src  (React + TypeScript + Vite + React Flow studio, via REST)

The native dependency edges are crates/calc-flow ← calc-flow-connectors and crates/calc-flow ← crates/calc-flow-python ← python/calc_flow ← web-ui/backend. The frontend talks to the backend over the /api/v3 REST contract only; the Python package is not a second engine.

Path Purpose
crates/calc-flow/ Native core: batches, ports/operators, graph compiler, DataFusion runtime, UDF/provider registries, runners, checkpoints, project stores
crates/calc-flow-connectors/ Trusted file, Kafka, PostgreSQL, MySQL, ClickHouse, HTTP, and WebSocket connectors behind feature gates
crates/calc-flow-python/ PyO3 binding exposing the core as calc_flow._native
python/calc_flow/ Python expressions and SQL, pipe, Arrow collection, owned stream results, lowering, and runtime integrations
web-ui/backend/ calc-flow-studio FastAPI service under /api/v3, loopback-bound, spawned bounded continuous-job workers
web-ui/src/ React + TypeScript + Vite + React Flow studio; API types generated from web-ui/openapi.json
schemas/ project-v3.schema.json, the canonical generated project contract
examples/ Executable Python expression and integration examples
benchmarks/ Benchmark workloads; scheduled regression gates and informational comparisons

Data and execution model

  • Table data is Arrow-backed. The Rust runtime executes row expressions and SQL with DataFusion and owns native rolling, window, and cross-section operators.
  • NumPy and JAX are optional Python array providers. They are registered explicitly and evaluate a bounded, allowlisted expression language.
  • Raw tables or arrays never cross a graph or runner boundary; they are wrapped in immutable Batch envelopes.
  • Project documents are strict, data-only JSON/YAML with format_version: 3. They select batch or stream runtime mode explicitly; stream documents reference registered connectors and named secrets without embedding credentials, callables, import paths, or table backend selectors.
  • Table and mixed graph runs own one run-scoped DataFusion session. External-only NumPy/JAX runs own no DataFusion configuration, UDF state, or runtime and return an empty DataFusion metrics list.
  • Convenience batch calls return Arrow tables. Explicit plan execution returns named Batch outputs, per-node timings, metadata, and DataFusion diagnostics.
  • Python executions accept reusable frozen ExecutionOptions with deep-copied strict-JSON settings and a cooperative, timezone-aware deadline normalized to UTC.
  • TableExpr.stream and Program.stream own a single native job with bounded backpressure. SQL accepts one alias in a stream and runs per native batch; SQL aggregation, sorting, and limits do not span batches.
  • The source-driven StreamingRunner consumes a StreamExecutionPlan, owns async source/sink bindings, and returns a one-owner StreamingJob.
  • Managed epoch checkpoints use LocalStateBackend segments and strict v3 CheckpointManifest documents. Exactly-once compatibility is proved per requested output; ordinary sinks can provide at-least-once delivery on a lossless replayable route. Async iterable convenience inputs provide best effort.

The capabilities and execution model are introduced in docs/introduction.md. The complete component and lifecycle design is in docs/design.md, and the practical continuous tutorial is docs/streaming-guide.md.

Trusted extensions

Python applications may register trusted vectorized DataFusion scalar UDFs on a Runtime. Every registration declares provider, name, version, exact Arrow input types, return type, and volatility. Graph nodes select registrations explicitly with (provider, name, version) references. Serialized projects contain references only.

Runtime extension authors use UdfRegistry for native DataFusion UDFs and ProviderRegistry for explicitly registered external operators.

Studio

web-ui/backend/ is the independently packaged calc-flow-studio FastAPI service. web-ui/ is the React, TypeScript, Vite, and React Flow client. The local service:

  • exposes the v3 REST API under /api/v3;
  • binds only to loopback and is intentionally single-user;
  • validates and stores v3 project documents;
  • runs bounded continuous jobs in spawned workers;
  • serves generated frontend assets from the Studio wheel.

Start both development processes on macOS, Linux, or WSL:

./web-ui/scripts/start_web_ui.sh

On native Windows PowerShell:

.\web-ui\scripts\start_web_ui.ps1

Open http://127.0.0.1:5173, then stop the managed processes with the matching command for your platform:

./web-ui/scripts/stop_web_ui.sh
.\web-ui\scripts\stop_web_ui.ps1

Both launchers keep logs and process state under .calc-flow-web/.

The checked OpenAPI contract is web-ui/openapi.json; generated TypeScript request and response types are in web-ui/src/api/schema.d.ts.

Project contracts

Calc Flow accepts strict project-v3 documents and exposes the Studio /api/v3 surface. Read projects and persistence for validation, serialization, and reloading a graph. Historical changes are recorded in CHANGELOG.md.

Development

Large Cargo and Maturin outputs should use the repository target/ tree. The complete CI/full-verification command reference is below. Local changes use the smallest affected checks under AGENTS.md Verification; full regression, Rust 90% coverage, and Studio backend 85% coverage belong to CI; routine performance gates run on the benchmark schedule:

uv sync --extra dev
cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
uv run python scripts/run_rust_tests.py
CALC_FLOW_CONNECTOR_CONTAINERS=1 \
  CALC_FLOW_KAFKA_BOOTSTRAP=localhost:9092 \
  CALC_FLOW_PG_TEST_URL=postgresql://postgres:postgres@localhost:5432/postgres \
  CALC_FLOW_MYSQL_TEST_URL=mysql://root:calcflow-test@localhost:3306/calcflow \
  CH_TEST_URL=http://localhost:8123 \
  uv run python scripts/run_rust_coverage.py
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps

uv run maturin develop
JAX_PLATFORMS=cpu uv run pytest python/tests -q
JAX_PLATFORMS=cpu uv run python scripts/run_examples.py
uv run ruff check .
uv run ruff format --check .

cd web-ui/backend
uv run --project . --extra dev pytest --cov=calc_flow_studio

cd ..
npm ci
npm run sync:api
npm run build
npm test
npm run test:e2e
npm audit --omit=dev

Regular CI runs cargo audit, cargo deny --locked check, core package inspectors, and isolated wheel smoke tests. The Python release workflow builds, verifies, and publishes core package artifacts. See AGENTS.md for the maintained repository commands and constraints.

Documentation

License

Apache-2.0 — see LICENSE.

Release files for calc-flow-python 2026.9.24

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

Source distribution (sdist)

Source distribution for calc-flow-python 2026.9.24
File Size Uploaded
calc_flow_python-2026.9.24.tar.gz 1.4 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for calc-flow-python 2026.9.24
File
calc_flow_python-2026.9.24-cp313-abi3-win_amd64.whl CPython 3.13 abi3 Windows x86-64 Details
calc_flow_python-2026.9.24-cp313-abi3-manylinux_2_28_x86_64.whl CPython 3.13 abi3 Linux glibc 2.28+ x86-64 Details
calc_flow_python-2026.9.24-cp313-abi3-manylinux_2_28_aarch64.whl CPython 3.13 abi3 Linux glibc 2.28+ ARM64 Details
calc_flow_python-2026.9.24-cp313-abi3-macosx_11_0_arm64.whl CPython 3.13 abi3 macOS 11.0+ ARM64 Details
calc_flow_python-2026.9.24-cp313-abi3-macosx_10_12_x86_64.whl CPython 3.13 abi3 macOS 10.12+ x86-64 Details
calc_flow_python-2026.9.24-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
calc_flow_python-2026.9.24-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
calc_flow_python-2026.9.24-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
calc_flow_python-2026.9.24-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
calc_flow_python-2026.9.24-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 455.5 MB

Release files / calc_flow_python-2026.9.24.tar.gz

Download URL calc_flow_python-2026.9.24.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
9c17f81271e2afaf4f4ab87bba6d040dc5f586ad8f2832d233348413436d8310
BLAKE2b-256 checksum
How to use checksums
8d14bddf13e7ae9042294720815d9853ef3adecfb467e3e5cbecbc0cec7a1cc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp313-abi3-win_amd64.whl

Download URL calc_flow_python-2026.9.24-cp313-abi3-win_amd64.whl
Size 47.2 MB
Tags CPython 3.13 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
712cea8427db9264bef575a75bd46d9b15c735ad6a8a5b3e8ba6a0cd49bfb455
BLAKE2b-256 checksum
How to use checksums
e2c41659fa8fd4ea670b5077174680f2de286e7b9717cc406935db6bc356623d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp313-abi3-manylinux_2_28_x86_64.whl

Download URL calc_flow_python-2026.9.24-cp313-abi3-manylinux_2_28_x86_64.whl
Size 47.6 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
5a93f11035e12c7d3259424c6d2b021ba7955615f4b50f611650b6d4515d4b04
BLAKE2b-256 checksum
How to use checksums
db54e16d31d1458f5ee7184df336f2f7ca30aef5131a76a951442fb5aed5c1ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp313-abi3-manylinux_2_28_aarch64.whl

Download URL calc_flow_python-2026.9.24-cp313-abi3-manylinux_2_28_aarch64.whl
Size 44.4 MB
Tags CPython 3.13 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
e6a8473fffa41230f9610c90044d4be2ca61cd5d822dec1c5684e91230ad5d42
BLAKE2b-256 checksum
How to use checksums
bef895fad5bbcb65defa09249821c802136496635ea4cfc4162b9762d14f8886
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp313-abi3-macosx_11_0_arm64.whl

Download URL calc_flow_python-2026.9.24-cp313-abi3-macosx_11_0_arm64.whl
Size 42.6 MB
Tags CPython 3.13 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
419ebe85a52ee52ef218129e9eea2ac02ad7d3d7764d5987e5f1993a7f55a94d
BLAKE2b-256 checksum
How to use checksums
ba1a64ddb6ce133c20962b592142d55afe8b35510d5295d55a48574c9eb64c18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp313-abi3-macosx_10_12_x86_64.whl

Download URL calc_flow_python-2026.9.24-cp313-abi3-macosx_10_12_x86_64.whl
Size 45.2 MB
Tags CPython 3.13 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4258f2b7126db42af9d0c362dc75e3d089e711d015dcf2d0c5ba7572f9546b68
BLAKE2b-256 checksum
How to use checksums
ff2c2ad4309f029e6eac1058761d64ee93995f8605b041852e277ff10aa7485e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp39-abi3-win_amd64.whl

Download URL calc_flow_python-2026.9.24-cp39-abi3-win_amd64.whl
Size 47.3 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6a875c77e39ec3cc37099d994138c230a4f8cce791e405fca95ed3781be4312f
BLAKE2b-256 checksum
How to use checksums
4782255ce174e9a705821e4535223bda08de68cd47ea83f536ba6f8ab8800bd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL calc_flow_python-2026.9.24-cp39-abi3-manylinux_2_28_x86_64.whl
Size 47.6 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
3bff3d95f9a2d4f728ce35de84c8e3ba897e9716957fe77c5d4085e47c9917b7
BLAKE2b-256 checksum
How to use checksums
2e7b0c18fc93f1de8f40ad335393642f31e6526d362546151bc03ab27dfa0972
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL calc_flow_python-2026.9.24-cp39-abi3-manylinux_2_28_aarch64.whl
Size 44.4 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
0529ed775ec32c9a357d1b691bbe5b29a0c60d8ad060383c32ff5701a81b1da2
BLAKE2b-256 checksum
How to use checksums
3f53353561918227256dde3c382b5b5d1d5da10b3b9f6284676db069b7a89a70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp39-abi3-macosx_11_0_arm64.whl

Download URL calc_flow_python-2026.9.24-cp39-abi3-macosx_11_0_arm64.whl
Size 42.7 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
da2a426f1169e26672474471b8af2ce41378929bd742cb6fb46d3554a25e0b70
BLAKE2b-256 checksum
How to use checksums
85cc87af198be775123f064b4f7d737bba0048e0d255a4442509c4bdbd78c876
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release files / calc_flow_python-2026.9.24-cp39-abi3-macosx_10_12_x86_64.whl

Download URL calc_flow_python-2026.9.24-cp39-abi3-macosx_10_12_x86_64.whl
Size 45.2 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ec44c6ad2c3d629e7e69f1519911f45b6317ee417cfd441cbeff36068a10667a
BLAKE2b-256 checksum
How to use checksums
e31bddd080e50655082bc50cfed4cb9b0f3a2c8aceabff5036355e3f1d75e1aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.9.24 This release

11 release files

4.0.0

6 release files

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