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.8.0.tar.gz (30.7 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.8.0-py3-none-any.whl (35.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kubefn-0.8.0.tar.gz
Algorithm Hash digest
SHA256 092bb17cfc45444ebffe7dac5581d14853e649d574367ad0e909e7665dfd1ec5
MD5 11be415980700c5087de6f7ace017521
BLAKE2b-256 3f4f31709b67a664e2ca5e01d9956f28775548e182b165708f37657e544e23ea

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kubefn-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 35.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.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71dcdd4f89547df5bb39c713f904bb0f64fd86a6561a50bd4eaa5a4073b748dc
MD5 d7abf578d354535c88c472afb7701fe6
BLAKE2b-256 bcc75c2d76b94ece1ba89415c6f61ba846325dce1b2096800493e8ef6d5cc0cb

See more details on using hashes here.

Provenance

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