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
- Website: https://kubefn.com
- GitHub: https://github.com/kubefn/kubefn
- Paper: DOI: 10.5281/zenodo.19161471
- JVM Runtime:
com.kubefn:kubefn-apion Maven Central - CLI:
brew tap kubefn/tap && brew install kubefn
Metadata
Release files for kubefn 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kubefn-0.8.0.tar.gz | 30.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kubefn-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.9 kB
Release files / kubefn-0.8.0.tar.gz
| Download URL | kubefn-0.8.0.tar.gz |
|---|---|
| Size | 30.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
092bb17cfc45444ebffe7dac5581d14853e649d574367ad0e909e7665dfd1ec5
|
|
BLAKE2b-256 checksum How to use checksums |
3f4f31709b67a664e2ca5e01d9956f28775548e182b165708f37657e544e23ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 29, 2026.
Transparency logRelease files / kubefn-0.8.0-py3-none-any.whl
| Download URL | kubefn-0.8.0-py3-none-any.whl |
|---|---|
| Size | 35.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71dcdd4f89547df5bb39c713f904bb0f64fd86a6561a50bd4eaa5a4073b748dc
|
|
BLAKE2b-256 checksum How to use checksums |
bcc75c2d76b94ece1ba89415c6f61ba846325dce1b2096800493e8ef6d5cc0cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 29, 2026.
Transparency log