Skip to main content

MLOps toolkit

Project description

Raine

Raine is an MLOps toolkit for the full model lifecycle: data preparation and feature engineering, training pipeline orchestration (Kubeflow), and model serving. The goal is reusable building blocks you can compose across local development and cloud deployment.

Status: only raine.serve.artifacts is implemented and documented today — packaging a handler, traced local code, model assets, and runtime dependencies into a self-contained bundle. Other areas of the repo are work in progress.

Install

pip install raine

Model packaging does not require LitServe. To run a LitServe-based handler, install the optional serve extra for convenience:

pip install "raine[serve]"

For PyTorch handlers, also install the torch extra. Other extras (gcp, train, data) cover optional tooling elsewhere in the repo and are not required for model packaging.

Model bundles

save_model writes a directory like:

my_model/
├── code/              # traced local Python (handler + imports)
├── artifacts/         # weights, configs, and other assets
├── artifacts.json     # logical name → bundle path index
├── pyproject.toml     # merged runtime dependencies
└── pylock.toml        # locked dependency export (uv)

At serving time, load the handler with from_bundle. In setup(), access bundle assets via self.context.artifacts, similar to MLflow's PythonModelContext.

Quick start

RaineModel is a mixin — it does not depend on any serving framework. The example below uses LitServe (pip install "raine[serve]"); mix it with your own base class instead if you prefer.

import litserve as ls
from raine.serve.artifacts import RaineModel

class MyInferenceAPI(RaineModel, ls.LitAPI):
    def __init__(self):
        super().__init__(max_batch_size=1)

    def setup(self, device):
        weights = self.context.artifacts["weights"]
        config = self.context.artifacts["config"]
        ...

api = MyInferenceAPI.from_bundle("/path/to/my_model", max_batch_size=1)
ls.LitServer(api).run(port=8080)

Export from a dedicated script:

handler = MyInferenceAPI()
handler.save_model(
    output_dir="./my_model",
    artifacts={
        "config": "/path/to/config.json",
        "weights": "/path/to/weights",
    },
)

Common options

Parameter Purpose
source_dir Root for code tracing (defaults to the handler module directory)
code_seeds Extra modules/classes to include in code/
code_renames Rename files in the bundle, e.g. {"inference_en.py": "inference.py"}
dependency_extras PEP 621 optional deps from your pyproject.toml
dependency_groups uv/poetry dependency groups to merge
pyproject_toml_path Explicit deps manifest (overrides upward search)

Local testing without a full export

Use staged_handler to symlink a bundle layout and yield a loaded handler:

from raine.serve.artifacts import staged_handler

with staged_handler(
    MyInferenceAPI,
    artifacts={"weights": weights_path, "config": config_path},
    source_dir=handler_dir,
    code_renames={"inference_en.py": "inference.py"},
    max_batch_size=1,
) as api:
    ls.LitServer(api).run(port=8080)

Example

See examples/artifact_packaging/ for a minimal export script, handler, and sample assets.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raine-0.1.1.tar.gz (296.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raine-0.1.1-py3-none-any.whl (64.0 kB view details)

Uploaded Python 3

File details

Details for the file raine-0.1.1.tar.gz.

File metadata

  • Download URL: raine-0.1.1.tar.gz
  • Upload date:
  • Size: 296.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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}

File hashes

Hashes for raine-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4c8626aaa7d95f5140beaef7423d1ec01cf6fae76cb86922f7cfb33e533180f3
MD5 518a04d8372852ce190505c6be6dca43
BLAKE2b-256 82750829281e5ca2da8e975e2181087d62c59476ec93159add5d9f7a31bd0d2c

See more details on using hashes here.

File details

Details for the file raine-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: raine-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 64.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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}

File hashes

Hashes for raine-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fff2820c75a128f314077a9acf6ca12c068656a3e5a93df04972a79d678ab68c
MD5 834dedd359c6f412be254f5befb1deca
BLAKE2b-256 5f90d34f8b375100748e4215865fd3130a689692fbba53d9f88be91002ffc94f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page