Skip to content

Python SDK

Raise SDK is a Python module for local experiment validation around RAISE scripts. It does not replace uploading a script and running it on a certified node.

RAISE Python SDK.

In the current version (0.2.10), the SDK includes two submodules, revo (Remote Execution Validation Operations), code_checker (Code Quality Checker), and a utils folder. Requires Python 3.8 or newer (and below 4).

  • REVO (Remote Execution Validation Operations) — automates dependency handling, dataset selection, and running the main script (Python, JavaScript, or R) with logging and environment checks.
  • Code_checker (Code Quality Checker) — two interchangeable backends:
    1. Ruff — a zero-plugin, Rust-powered linter.
    2. Flake8 — classic Python linter, with a default config at raise_sdk/code_checker/flake8/flake8-config.ini.
      • RCP01 disallows hard-coded UUIDs
      • RCP02 disallows literal backslashes in paths
  • Utils — file, folder, and dialog helpers.

Package page: https://pypi.org/project/raise-sdk/

Installation

Terminal window
pip install raise-sdk

To verify the installation:

import raise_sdk

Troubleshooting

  • Use a virtual environment and activate it before installing.
  • On some systems you may need pip3 install raise-sdk (hyphen, same as the PyPI name).

Usage

The main entry point is start() on the revo submodule:

from raise_sdk import revo
revo.start(
script=[], # Paths to script files. Main file: main.py, main.js, or main.R
requirements=[], # Paths to requirements / lock files
dataset=[], # Paths to dataset files
programming_language="python",
version="3.11",
quality_check=False,
)

If script, requirements, or dataset are omitted, the module prompts for files with a dialog. If quality_check is True, it runs Ruff or Flake8 and exits on failure. The module tries to connect to Docker. If Docker is missing, you can run as a normal Python process (requirements then install into the active environment). With Docker, programming_language and version select the image. The default is Python 3.11.

How It Works

  1. File Selection — dialogs if paths are omitted. The main file must be main.py, main.js, or main.R depending on language.
  2. Code Quality Check — Ruff with a fixed rule set, or Flake8 with optional custom plugins (RCP01 / RCP02).
  3. Local Setup — LocalCodeRunner copies files, writes a Dockerfile when Docker is available, and logs the run.
  4. Execution — Docker container when possible; otherwise a local Python process after confirmation.
  5. Logging — LocalCodeRunner.status_code:
    • 0 — success
    • 1 — results folder empty or a result file empty
    • 2 — exception while running or checking results

API Reference

start(script, requirements, dataset, programming_language, version, quality_check)

Imported as start() from raise_sdk.revo.

  • script (list of str) — script paths. Main file main.py, main.js, or main.R.
  • requirements (list of str) — requirements or lockfile paths.
  • dataset (list of str) — dataset file paths.
  • programming_language (str, optional) — default "python".
  • version (str, optional) — default "3.11".
  • quality_check (bool, optional) — default False.

Raises SystemExit if Docker is unavailable and you decline the fallback, or if the quality check fails.

LocalCodeRunner

  • prepare_experiment_path() — copy files and write a Dockerfile when Docker is available.
  • build_docker_image() — build the experiment image.
  • run_docker_container() — run in Docker with logs and results mounts.
  • run_python() — run as a local Python process.
  • check_results() — require non-empty result files.
  • remove_image() — delete the experiment image.
  • environment_variables() — prepare container environment variables.