Python runtime via [uv](https://github.com/astral-sh/uv) for [Freestyle](https://freestyle.sh) VMs.
npm install @freestyle-sh/with-uvPython runtime via uv for Freestyle VMs.
``bash`
npm install @freestyle-sh/with-uv freestyle-sandboxes
`typescript
import { freestyle } from "freestyle-sandboxes";
import { VmUv } from "@freestyle-sh/with-uv";
const { vm } = await freestyle.vms.create({
with: {
uv: new VmUv(),
},
});
const res = await vm.uv.runCode({
code: "import json; print(json.dumps({ 'hello': 'world' }))"
});
console.log(res);
// { result: { hello: 'world' }, stdout: '{"hello": "world"}\n', statusCode: 0 }
`
`typescript`
new VmUv({
version: "0.5.0", // Optional: specific uv version
pythonVersion: "3.13", // Optional: Python version (default: "3.14")
})
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| version | string | undefined | uv version to install. If not specified, installs the latest version. |pythonVersion
| | string | "3.14" | Python version to install via uv. |
Executes Python code using uv's managed Python runtime.
Returns: Promise
`typescript``
type RunCodeResponse
result: Result; // Parsed JSON from stdout (if valid JSON)
stdout?: string; // Raw stdout output
stderr?: string; // Raw stderr output
statusCode?: number; // Exit code
};