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.5.1.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.5.1-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kubefn-0.5.1.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.5.1.tar.gz
Algorithm Hash digest
SHA256 dce2afeeafb732b5fe3e49ec90601cacd65ae1b376098ff3a9ba684e67b5159b
MD5 41fefa826e84d7546c406091176cc35b
BLAKE2b-256 af69c3eaadd5063a39620844f67b8d7a5c2fa61f58e651706e64a1d2f524159d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kubefn-0.5.1.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.5.1-py3-none-any.whl.

File metadata

  • Download URL: kubefn-0.5.1-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.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64a3da100fbfe95f7f8f710d3ec540ee3aa175ce19e4e22e1d1006b0bcc37631
MD5 86f5bebc79e150b9fdd5c6b57d3978f1
BLAKE2b-256 288719f061f871e0b7b6975438e0bcdf2e33bc7ac9bc262b2e8cb8864246e95c

See more details on using hashes here.

Provenance

The following attestation bundles were made for kubefn-0.5.1-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