🤖 AI Summary
Pyproc is a lightweight open-source bridge that lets Go programs call Python functions like local calls — without cgo, HTTP/gRPC microservices, or heavy process startup — by running a pool of Python worker processes and communicating over Unix Domain Sockets. It targets common use cases where Go services need Python ecosystems (PyTorch/TensorFlow models, pandas/numpy data processing, legacy Python code or single-ecosystem libraries) while avoiding CGO complexity, network latency, and the GIL bottleneck. Calls use a simple API (pool.Call(ctx, "fn", input, &output)) and Python workers expose functions with a small decorator (@expose), so deployment is as easy as shipping one Go binary + Python scripts in the same host/pod.
Technically, pyproc is a pure-Go implementation using UDS IPC, connection pooling, process isolation (Python crashes don’t kill Go), and multi-process parallelism to bypass the GIL. It’s optimized for JSON payloads under ~100KB and same-host scenarios (Kubernetes same-pod, Docker with shared socket, Linux/macOS). Benchmarks show p50 latency ~45 µs and up to ~200k req/s with 8 workers on a laptop-class machine, and it includes health checks, graceful shutdown, and automatic restarts. Limits: not for cross-host communication, Windows UDS, GPU management, or large-scale ML serving (use Triton/Serve/Ray for that). System requirements: Go 1.22+, Python 3.9+ (3.12 recommended).
Loading comments...
login to comment
loading comments...
no comments yet