flyteplugins-rs
[!WARNING] Experimental. The APIs and wire contracts may change without notice.
Launch Rust Flyte tasks 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.
pip install flyteplugins-rs
from pathlib import Path
import flyteplugins_rs as rs
my_task, rust_env = rs.rust_task(
crate_dir=Path(__file__).parent,
binary="hello-trace",
retries=2, # any TaskTemplate option passes through
)
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:
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-interfacewhen a local build exists, and refreshes the generated_generated_interface.pyfrom it. Inside a container (no cargo build) the generated module is used instead. - Image — declares the worker image as
flyte.Imagelayers, 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 whoseargs[0]is the binary (image layers cannot set an ENTRYPOINT).
Bringing your own Dockerfile
By default the worker image is declared as flyte.Image layers, which is what
lets the remote builder compile it with no docker on your machine. When that
is not enough — a private base image, extra system libraries, a multi-stage build
that keeps the Rust toolchain out of the final image — pass a Dockerfile instead:
my_task, rust_env = rs.rust_task(
crate_dir=Path(__file__).parent,
binary="hello-trace",
dockerfile=Path(__file__).parent / "Dockerfile",
)
Three things such a Dockerfile has to get right:
- Install the binary at
/usr/local/bin/<binary>. The task passes that exact path asargs[0]; it is the one hard-coded contract between the image and the task. - Ship
libpython.flyte_coreenablespyo3/auto-initialize, so the worker links against it. A slim runtime stage needs thelibpython3.Npackage, not just thepython3interpreter — Debian'spython3links it statically and does not provide the shared object. - An
ENTRYPOINTis optional. With none set, Kubernetes execs the args directly. Setting one is fine too: the worker skips a leading token it does not recognise, so one arg list works either way.
The build context is the directory holding the Dockerfile, so COPY paths are
relative to it. workspace= and dockerfile= are mutually exclusive — a
Dockerfile brings its own context, so put the copying in the Dockerfile.
[!IMPORTANT] Custom Dockerfiles build only with the local docker builder. The remote builder takes declarative layers, not a Dockerfile it would have to parse, and rejects one outright. With
image: {builder: remote}in your config, this path needsflyte --image-builder local runand a working local docker.
A worked example is the
custom-image
example: multi-stage so the toolchain does not ship, and installing a system
package the task actually depends on.
Two extra requirements. flyte.Image.from_dockerfile has no registry to
inherit, so set RUST_IMAGE_REGISTRY or pass registry=. And the image is named
<binary>-worker unless image_name= says otherwise — the first push to a name
creates a new repository, which registries like GHCR make private by default, so
the build and push succeed and the task then cannot start. Make the package
public once, or point image_name= at one that already exists.
Compatibility
The launcher and the worker agree on a versioned descriptor contract, currently
flyte_interface_version = 1. A worker built against a newer SDK is refused at
launch with a message naming both sides, rather than failing inside the
container. Package versions are deliberately not kept in step with the
flyte Rust crate's — see
docs/releasing.md.
Developing
To run against a checkout instead of the released package:
git clone https://github.com/flyteorg/flyte-sdk-rs && cd flyte-sdk-rs
./scripts/dev-setup.sh
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flyteplugins_rs-0.0.3.tar.gz.
File metadata
- Download URL: flyteplugins_rs-0.0.3.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8795682ca78f18a9e1ca085b16d0adeb6ea7062525e0a6e79230f702d7af27c5
|
|
| MD5 |
83acace67ecfd02a328177b4ee8bae51
|
|
| BLAKE2b-256 |
0f36eddd1768c2ab00934aa8d02d85f4dc9ffe466c9607eeba218908f1dbd2d9
|
Provenance
The following attestation bundles were made for flyteplugins_rs-0.0.3.tar.gz:
Publisher:
release-python.yml on flyteorg/flyte-sdk-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flyteplugins_rs-0.0.3.tar.gz -
Subject digest:
8795682ca78f18a9e1ca085b16d0adeb6ea7062525e0a6e79230f702d7af27c5 - Sigstore transparency entry: 2441066312
- Sigstore integration time:
-
Permalink:
flyteorg/flyte-sdk-rs@8f7e50246a790533a18d13c54595d6ba3aa44ef6 -
Branch / Tag:
refs/tags/py-v0.0.3 - Owner: https://github.com/flyteorg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@8f7e50246a790533a18d13c54595d6ba3aa44ef6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flyteplugins_rs-0.0.3-py3-none-any.whl.
File metadata
- Download URL: flyteplugins_rs-0.0.3-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f96c38ff5066beca6ef8f7d0e65fd96e4a67fdd6f891871dd8021e14658e5fb
|
|
| MD5 |
026d46eb078e8cb74bf36c85140d35b4
|
|
| BLAKE2b-256 |
d1b9136cbea471e8c4e17210f0efcfea581496df61559bb10c8ae28d0087bc19
|
Provenance
The following attestation bundles were made for flyteplugins_rs-0.0.3-py3-none-any.whl:
Publisher:
release-python.yml on flyteorg/flyte-sdk-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flyteplugins_rs-0.0.3-py3-none-any.whl -
Subject digest:
3f96c38ff5066beca6ef8f7d0e65fd96e4a67fdd6f891871dd8021e14658e5fb - Sigstore transparency entry: 2441066506
- Sigstore integration time:
-
Permalink:
flyteorg/flyte-sdk-rs@8f7e50246a790533a18d13c54595d6ba3aa44ef6 -
Branch / Tag:
refs/tags/py-v0.0.3 - Owner: https://github.com/flyteorg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@8f7e50246a790533a18d13c54595d6ba3aa44ef6 -
Trigger Event:
push
-
Statement type: