Metadata-Version: 2.4
Name: rutis
Version: 0.7.0
Summary: Write rutis plugins in Python, and the runtime that runs them
License-Expression: MIT
Project-URL: Homepage, https://github.com/arcships/rutis
Project-URL: Documentation, https://github.com/arcships/rutis/tree/main/docs/guide
Keywords: rutis,plugin,rutis-plugin
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Provides-Extra: network
Requires-Dist: websockets>=13; extra == "network"

# rutis

Write [rutis](https://github.com/arcships/rutis) plugins in Python, and the runtime that runs them.

```python
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"], provides={"weather": Weather})
```

Test it without a host:

```python
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"
```

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]`). Packaged plugins register under the entry point group `rutis.plugins`. Python 3.12 or later; no dependencies.

Start a project with `uvx rutis-host new <name> --lang python`. Guide (Chinese): [docs/guide/python-plugin.md](https://github.com/arcships/rutis/blob/main/docs/guide/python-plugin.md).
