| name | coreweave-sdk-patterns |
| description | Production-ready patterns for CoreWeave GPU workload management with kubectl and Python.
Use when building inference clients, managing GPU deployments programmatically,
or creating reusable CoreWeave deployment templates.
Trigger with phrases like "coreweave patterns", "coreweave client",
"coreweave Python", "coreweave deployment template".
|
| allowed-tools | Read, Write, Edit |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","gpu-cloud","kubernetes","inference","coreweave"] |
| compatible-with | claude-code |
CoreWeave SDK Patterns
Overview
CoreWeave is Kubernetes-native -- use kubectl, Kubernetes Python client, or Helm for programmatic management. These patterns cover GPU-aware deployment templates, inference client wrappers, and node affinity configurations.
Instructions
GPU Affinity Helper
from dataclasses import dataclass
@dataclass
class GPUConfig:
gpu_class: str
gpu_count: int = 1
memory_gb: int = 32
cpu_cores: int = 4
GPU_CATALOG = {
"a100-80gb": GPUConfig("A100_PCIE_80GB", memory_gb=48, cpu_cores=8),
"h100-80gb": GPUConfig("H100_SXM5", memory_gb=64, cpu_cores=12),
"l40": GPUConfig("L40", memory_gb=24, cpu_cores=4),
"a100-8x": GPUConfig("A100_NVLINK_A100_SXM4_80GB", gpu_count=8, memory_gb=256, cpu_cores=64),
}
def gpu_affinity_block(gpu_class: str) -> dict:
return {
"nodeAffinity": {
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [{
"matchExpressions": [{
: ,
: ,
: [gpu_class],
}]
}]
}
}
}
() -> :
{
: {
: (config.gpu_count),
: ,
: (config.cpu_cores),
},
: {
: (config.gpu_count),
: ,
: (config.cpu_cores // ),
},
}