Skip to content

Python Runtime

The Python runtime enables you to execute user-defined Python handlers. It registers a Function kind python and supports three actions: job, serve, and build.

  • job: Execute a Python handler as a one-off job
  • serve: Deploy a Python handler as a long-lived service
  • build: Create a Docker image with all required dependencies for efficient execution

Prerequisites

Supported Python versions:

  • Python ≥ 3.9, < 3.13

Required package:

  • digitalhub-runtime-python

Install from PyPI:

pip install digitalhub-runtime-python

Usage overview

To execute a Python handler on the platform:

  1. Implement the handler as described in handler definition.
  2. Create a Function resource that references your handler and declares inputs/outputs and call function.run() to execute the handler.
  3. Retrieve eventual outputs from the Run.

See Examples for code samples.