Registry / devops / codeflare-sdk

codeflare-sdk

JSON →
library0.37.0pypypi✓ verified 86d ago

Python SDK for CodeFlare, providing high-level abstractions to deploy and manage Ray clusters on Kubernetes, with integrated job submission and resource management. Current version 0.37.0, requires Python >=3.11, <4.0, and is actively maintained with monthly releases.

pip install codeflare-sdk
INSTALL
IMPORT
SIG · CODEFLARE-SDK
C
codeflare-sdk
devopspythonv0.37.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Cluster
from codeflare_sdk import Cluster
from codeflare.cluster import Cluster
Wrong module name: the correct package is 'codeflare_sdk', not 'codeflare'.
ClusterConfiguration
from codeflare_sdk import ClusterConfiguration
from codeflare_sdk.config import ClusterConfiguration
ClusterConfiguration is exported from the top-level package, not from a submodule.

Create a Ray cluster on Kubernetes, run a remote function, and tear down.

from codeflare_sdk import Cluster, ClusterConfiguration import os # Define cluster configuration config = ClusterConfiguration( name='example-cluster', namespace='default', num_workers=2, head_cpus='500m', head_memory='2Gi', worker_cpus='1', worker_memory='4Gi', min_workers=1, max_workers=4, ) # Create and start the cluster cluster = Cluster(config) cluster.up() # Wait for cluster to be ready cluster.wait_ready() print(f"Ray URI: {cluster.cluster_uri()}") # Submit a simple Ray job import ray ray.init(cluster.cluster_uri()) @ray.remote def hello(): return "Hello from Ray cluster" print(ray.get(hello.remote())) # Tear down cluster.down()
Debug
Known issues
breakingAppWrapper support removed in v0.34.0. Instantiation of Ray clusters now relies solely on Kuberay operator; any code using AppWrapper objects will break.
fix
Migrate to Kuberay-based configurations. Remove any AppWrapper references.
affects: >=0.34.0
breakingIn v0.33.0, the immutable image tag for Ray was updated to Ray v2.52.1. Clusters created with older SDK versions (pre-0.33.0) may fail if the operator is not updated.
fix
Upgrade the Kuberay operator to a compatible version. Ensure Ray image aligns with the SDK's default.
affects: >=0.33.0
gotchaCluster name must be a valid Kubernetes resource name (lowercase RFC 1123 subdomain). Since v0.36.0, invalid names cause early errors.
fix
Use only lowercase alphanumeric characters and hyphens; no underscores or uppercase.
affects: >=0.36.0
deprecatedUsage of 'codeflare-operator' is deprecated; all operator references have been replaced with 'kuberay' in v0.35.0. Old cluster configurations may stop working.
fix
Replace any references to codeflare-operator with kuberay in your cluster configuration or environment.
affects: >=0.35.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'codeflare'
Incorrect import path; the package is named 'codeflare_sdk', not 'codeflare'.
fix
Install the package (pip install codeflare-sdk) and import as 'from codeflare_sdk import Cluster'.
ValueError: Invalid cluster name 'MyCluster_1'. Must be a valid Kubernetes resource name
Cluster name contains uppercase letters or underscores, which violates RFC 1123.
fix
Use a lowercase name with only hyphens and alphanumeric characters, e.g., 'mycluster-1'.
ClusterError: Failed to get RayCluster resource: 'appwrapper.codeflare.codeflare.dev "..." not found'
AppWrapper CRD is no longer available in the cluster; requires Kuberay operator.
fix
Ensure Kuberay operator is installed and use ClusterConfiguration without AppWrapper-related settings.
Upgrade
Version history
0.37.0latest on PyPI · released May 8, 2026
Audit
Dependencies
kubernetesrequiredUsed to interact with Kubernetes API for cluster management.
rayrequiredCore distributed computing library that CodeFlare orchestrates.
Agent activity
28 hits · last 30 days
node
26
OpenAI (training)
1
Resources
codeflare-sdk — pip install codeflare-sdk · libregistry