Skip to main content

KubeFn Python Runtime — Live Application Fabric for Memory-Continuous Architecture

Project description

KubeFn Python Runtime

Memory-Continuous Architecture for Python — Functions share a CPython interpreter heap. Zero serialization between functions.

KubeFn is a Live Application Fabric where independently deployable functions share memory. The Python runtime brings this to ML/data science teams.

Install

pip install kubefn

Quick Start

from kubefn import function, HeapExchange

@function(path="/ml/features", methods=["POST"])
def extract_features(request, ctx):
    """Extract ML features and publish to shared heap."""
    user_id = request.get("userId", "user-001")

    features = {
        "recency": 0.8,
        "frequency": 12,
        "monetary": 450.0,
        "category_affinity": [0.3, 0.7, 0.1],
    }

    # Publish to heap — other functions read this zero-copy
    ctx.heap.publish(f"features:{user_id}", features)
    return {"features": len(features), "userId": user_id}


@function(path="/ml/predict", methods=["POST"])
def predict(request, ctx):
    """Read features from heap (zero-copy) and run inference."""
    features = ctx.heap.require("features:user-001")  # Same Python object, not deserialized

    score = sum(features.values()) / len(features) if isinstance(features, dict) else 0.5

    ctx.heap.publish("prediction:latest", {"score": score, "model": "v2"})
    return {"prediction": score}

Run

# Start the runtime
kubefn-python --port 8080 --functions-dir ./my-functions

# Or with Python module
python -m kubefn --port 8080 --functions-dir ./my-functions

Production Features

Feature Description
HeapExchange Zero-copy shared Python objects between functions
Circuit Breakers Per-function failure isolation (CLOSED/OPEN/HALF_OPEN)
Drain Manager Graceful hot-swap with in-flight request tracking
Request Timeout Configurable per-request deadline enforcement
Causal Introspection Event ring buffer with trace assembly
Prometheus Metrics Per-function latency histograms in exposition format
Heap Guard Size limits, TTL, memory pressure detection
Scheduler Engine Cron-based function scheduling (@schedule)
Admin API 12 endpoints: health, ready, functions, heap, breakers, metrics, traces, scheduler

Benchmarks

In-cluster (service-to-service on k3s):

  • 3-step ML pipeline: 5.4ms (vs 6-30ms equivalent microservices)
  • Speedup: 1.1-5.5x (full HTTP cycle, honestly measured)

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kubefn-0.7.0.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kubefn-0.7.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file kubefn-0.7.0.tar.gz.

File metadata

  • Download URL: kubefn-0.7.0.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kubefn-0.7.0.tar.gz
Algorithm Hash digest
SHA256 ef6169196a6da3ce38660107495eea2e81edfad9f564d9d4d146f161e919ca01
MD5 7105af9923ff18bfbb68747c9249cb9a
BLAKE2b-256 0ee2553e32a5141c7b575fcfcdb42142a1451a4a9d0ae8b9d563c30ecb4d186e

See more details on using hashes here.

Provenance

The following attestation bundles were made for kubefn-0.7.0.tar.gz:

Publisher: release.yml on kubefn/kubefn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kubefn-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: kubefn-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kubefn-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9412c8b11991ee64d27d93191b9edcdfcb9a33de0bccc63551de5b0ed6a28164
MD5 33ebd2a099ab67c109de0a8781998b38
BLAKE2b-256 0d4755d61f926deca856e92206d9c6421a2ac1f3802fad5de35770d8122fc9b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for kubefn-0.7.0-py3-none-any.whl:

Publisher: release.yml on kubefn/kubefn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page