Metadata-Version: 2.4
Name: flyteplugins-rs
Version: 0.0.1
Summary: Launch Rust Flyte tasks from Python
License: Apache-2.0
Requires-Python: >=3.10
Requires-Dist: flyte>=2.0.0
Description-Content-Type: text/markdown

# flyteplugins-rs

> [!WARNING]
> **Experimental**, and not yet published. The examples in this repository import
> it from source; APIs may change.

Launch [Rust Flyte tasks](https://github.com/unionai/flyte-sdk-rs) from Python.

A Rust task container runs a compiled binary and no Python. This package is the
launch-time half: it reads a worker binary's self-described interface, declares
the matching Flyte task, and builds the worker image from Rust sources.

```python
from pathlib import Path

import flyteplugins_rs as rs

import interface_gen  # generated by `<binary> describe-interface`

my_task, rust_env = rs.rust_task(
    crate_dir=Path(__file__).parent,
    binary="hello-trace",
    fallback_descriptor=interface_gen.DESCRIPTOR,
    retries=2,          # any TaskTemplate option passes through
)
```

```bash
flyte run task.py my_task --x 21 --label demo
```

The task's name, inputs, and outputs are never written here — they come from the
Rust fn signature, so renaming a parameter cannot silently diverge from what gets
launched.

`rust_env` is the environment holding the task. A Python parent calling it needs
`depends_on=[rust_env]`, which carries the worker image into the deployment plan:

```python
env = flyte.TaskEnvironment(name="my_pipeline", depends_on=[rust_env])

@env.task
async def pipeline(x: int) -> str:
    return await my_task(x=x, label="demo")
```

## What it does

- **Interface** — runs `<binary> describe-interface` when a local build exists,
  and refreshes the generated `interface_gen.py` from it. Inside a container
  (no cargo build) the generated module is used instead.
- **Image** — declares the worker image as `flyte.Image` layers, so the
  **remote** image builder can compile it (no Dockerfile, no local docker). No
  layer asks for Python, so the image gets no venv.
- **Task** — a container task typed `rust-task`, whose args match the worker's
  contract, and whose `args[0]` is the binary (image layers cannot set an
  ENTRYPOINT).
