Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

rutis

Write rutis plugins in Python, and the runtime that runs them.

from rutis import define_plugin


class Weather:
    def __init__(self, llm, city):
        self.llm, self.city = llm, city

    async def today(self):
        return f"{await self.llm.ask(self.city)} in {self.city}"


def apply(ctx, config):
    ctx.provide("weather", Weather(ctx.use("llm"), config["city"]))


plugin = define_plugin(apply, inject=["llm"])

What ctx.provide provides reaches rutis by itself, its methods the object's public callables, called as async. provides is optional: provides={"weather": Weather} (or {"weather": {"unit": "sync"}}) marks methods sync and tells rutis-host check what the plugin provides before it runs.

Events are one bus across every plugin, runtime and linked node (rutis 0.13): wherever a listener is, the result is the same.

def apply(ctx, config):
    async def check(text, next):           # in a waterfall, next comes last
        return "blocked" if "spam" in text else await next()

    ctx.on("chat/check", check)
    ctx.on("chat/said", lambda text: print(text), prepend=True)

# elsewhere
ctx.emit("chat/said", "hi")                # starts every listener, returns at once
await ctx.parallel("chat/said", "hi")      # waits for all; rutis.AggregateError on failures
await ctx.serial("chat/lookup", 7)         # the first result (not None / False)
await ctx.waterfall("chat/check", "hi", terminal=lambda text: "ok")
ctx.bail("chat/lookup", 7)                 # serial, synchronously
await ctx.filter(lambda d: d["row"] == "audit").parallel("chat/said", "hi")

A listener hears every event of the name on the one flat bus; a scope is a descriptor for filters. A failing emit listener is reported on stderr, never raised. rutis/* events can be listened to, not emitted. On unload a running listener's task is cancelled and waited for (at most RUTIS_SHUTDOWN_TIMEOUT).

A filter's descriptor is a dict: name, prefix, plugin, row, runtime, node, scope, global. plugin is the name the plugin declares, define_plugin(apply, name="chat-ui"); without one, the id of its row in the configuration (row). Errors from listeners in other processes arrive as rutis.RemoteError (rutis's own, such as BindingError, as their classes; rutis.AggregateError children too); on the fast path, within one process, the original exception may arrive instead, so match errors by name (and code), not by class. A row that unloaded cannot emit any more (BindingError). ctx.on, the emitters and disposers may be called from the plugin's own threads: they run on the runtime's loop, in call order (from a thread, parallel / serial / waterfall return an awaitable for that thread's loop, or a concurrent.futures.Future without one).

Test it without a host:

from rutis.testing import load

async with load(plugin, config={"city": "Oslo"}, services={"llm": FakeLlm()}) as t:
    assert await t.service("weather").today() == "sunny in Oslo"

The loaded plugin t has the same emit / parallel / serial / waterfall / bail / filter; plugins loaded with one rutis.testing.Bus share one flat bus; a scope is a filter descriptor (load(plugin, bus=bus, scope="t1/s1")). Descriptors give runtime "python" (load(..., runtime=) to change it); unload waits for running listeners at most RUTIS_SHUTDOWN_TIMEOUT (load(..., deadline=) seconds). With strict, errors reaching the plugin's own emitters arrive as RemoteError, as from another process.

A host runs plugins with python -m rutis <channel> <project> (it starts that itself); python -m rutis listen:wss://… --id <id> --peer <controller> <project> runs a runtime a host on another machine controls (install rutis[network]; not on CPython 3.13.6, whose TLS sockets deadlock, python/cpython#137583: use 3.13.7 or later); python -m rutis dial:wss://… --id <id> --peer <controller> <project> connects to that host instead and reconnects by itself (token in RUTIS_TOKEN, a further CA in RUTIS_CA). Packaged plugins register under the entry point group rutis.plugins. Python 3.10 or later; no dependencies.

Start a project with uvx rutis-host new <name> --lang python. Guide (Chinese): docs/guide/python-plugin.md.

Metadata

Release files for rutis 0.17.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for rutis 0.17.2
File Size Uploaded Provenance Actions
rutis-0.17.2.tar.gz 128.4 kB Without provenance Details for rutis-0.17.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rutis 0.17.2
File Interpreter ABI Platform Actions
rutis-0.17.2-py3-none-any.whl Python 3 none any Details for rutis-0.17.2-py3-none-any.whl

Total release size: 203.8 kB

Release files / rutis-0.17.2.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL rutis-0.17.2.tar.gz
Size 128.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bb145f7733f13b6f23631c2a4b4e89c685f16fbcd8784ba803e8c58956c99bc1
BLAKE2b-256 checksum
How to use checksums
4fe775ccf374b2a105ad9f6cb536695d610330f1d501c2268775455036582193
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / rutis-0.17.2-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL rutis-0.17.2-py3-none-any.whl
Size 75.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82e75896ceff37a35b7143d09df64d95d1051078ef6e526f5913577454ec74db
BLAKE2b-256 checksum
How to use checksums
43be97291a47bd147d6e58017dfa6733aa506034170c630579aa769f1bf5693a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for rutis 0.17.2

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.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.17.0 2 files With provenance
  • Added 0.17.2 2 files Without provenance

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page