Rubyx-py is a Ruby gem that enables direct in-process Python calls from Ruby without microservices or REST APIs. Powered by Rust via magnus and rb-sys, it embeds a Python interpreter into the Ruby process. Key features include synchronous module imports, eval with Ruby variable injection, GVL-aware async/await, non-blocking streaming for LLM token generation, bidirectional type conversion, persistent Python contexts, and Rails integration via a generator. Python dependencies are auto-managed by uv. Supports numpy, pandas, transformers, and other Python libraries callable directly from Rails controllers.

9m read timeFrom github.com
Post cover image
Table of contents
InstallRails Setup Simple ExampleRails Setup Advanced LLM ExampleStandalone SetupEval with GlobalsBytes / Binary DataPython ObjectsContextStreamingAsync / AwaitError HandlingLocal Python FilesAPI ReferenceType ConversionRequirementsLicense

Sort: