Skip to content

Volumes

Persistent volumes you mount into sandboxes, and their files.

Every method shows the same operation in each SDK; pick a language once and every tab on the site follows it.

Python TypeScript Go Ruby Java

One persistent volume; info is what the API last said about it.

Python exposes these as methods; see below.

def create(cls, name: str, *, size_gb: int, idempotency_key: str | None=None, client: 'SandboxClient | None'=None) -> 'Volume'
static
Parameter Type Default
name str
size_gb int
idempotency_key str | None None
client 'SandboxClient | None' None

Returns 'Volume'

Source: sdk/python/svm/volumes.py:69
def get(cls, volume_id: str, *, client: 'SandboxClient | None'=None) -> 'Volume'
static
Parameter Type Default
volume_id str
client 'SandboxClient | None' None

Returns 'Volume'

Source: sdk/python/svm/volumes.py:74
def list(cls, *, client: 'SandboxClient | None'=None) -> list['Volume']
static

Every live volume of the team, following pages.

Parameter Type Default
client 'SandboxClient | None' None

Returns list['Volume']

Source: sdk/python/svm/volumes.py:79

Not in the Python SDK’s Volume.

Not in the Python SDK’s Volume.

def exists(self, path: str) -> bool
Parameter Type Default
path str

Returns bool

Source: sdk/python/svm/volumes.py:113
def get_info(self, path: str) -> dict[str, Any]

The entry at path (name, kind, size, mode, modified_unix_ms); kind is "file", "dir", "symlink" or "other".

Parameter Type Default
path str

Returns dict[str, Any]

Source: sdk/python/svm/volumes.py:108
id: str

Property (read-only).

Not in the Python SDK’s Volume.

Not in the Python SDK’s Volume.

def list_files(self, path: str='/') -> list[dict[str, Any]]

The entries of a directory (name, kind, size, mode, modified_unix_ms, and owner and group when the guest names them); / is the root. kind is the API’s value: "file", "dir", "symlink" or "other".

Parameter Type Default
path str '/'

Returns list[dict[str, Any]]

Source: sdk/python/svm/volumes.py:102
def make_dir(self, path: str, *, parents: bool=True) -> None
Parameter Type Default
path str
parents bool True
Source: sdk/python/svm/volumes.py:138
def mount(self, path: str, *, subpath: str | None=None, read_only: bool=False) -> dict[str, Any]

A volume_mounts entry for Sandbox.create: the volume (or only its subpath directory) at path.

Parameter Type Default
path str
subpath str | None None
read_only bool False

Returns dict[str, Any]

Source: sdk/python/svm/volumes.py:93
name: str

Property (read-only).

def read(self, path: str, *, request_timeout: float | None=None) -> bytes

The whole file (at most 64 MiB).

Parameter Type Default
path str
request_timeout float | None None

Returns bytes

Source: sdk/python/svm/volumes.py:120
def read_text(self, path: str, encoding: str='utf-8') -> str
Parameter Type Default
path str
encoding str 'utf-8'

Returns str

Source: sdk/python/svm/volumes.py:125
def remove(self, path: str, *, recursive: bool=False) -> None
Parameter Type Default
path str
recursive bool False
Source: sdk/python/svm/volumes.py:156
def update_metadata(self, path: str, *, mode: int | None=None, owner: str | None=None, group: str | None=None) -> dict[str, Any]

Change a file’s or directory’s permission bits (mode, a number: 0o644), owner and group (names or numeric ids); only what is passed changes. Returns the entry afterwards. A path that does not exist is NotFoundError and a symlink is refused. At least one of the three is required.

Parameter Type Default
path str
mode int | None None
owner str | None None
group str | None None

Returns dict[str, Any]

Raises NotFoundError

Source: sdk/python/svm/volumes.py:141
def write(self, path: str, data: bytes | str, *, request_timeout: float | None=None) -> int

Replace the file with data (at most 64 MiB), making missing parent directories; returns the bytes written. The write is sealed into the volume before this returns.

Parameter Type Default
path str
data bytes | str
request_timeout float | None None

Returns int

Source: sdk/python/svm/volumes.py:128