SandboxHandle
handle.snapshot()
~/.microsandbox/snapshots/<name>/). The sandbox must be stopped or crashed. To place the artifact elsewhere, use Snapshot.save() / Snapshot.load() or move the self-contained artifact directory. Called on a SandboxHandle, obtained from Sandbox.get().
Parameters
namestrReturns
Example
Example
Sandbox
Sandbox.create()
from_snapshot= as a peer of image=. The two are mutually exclusive: pass exactly one. See Sandbox.create() for the full set of configuration kwargs.
Parameters
namestrfrom_snapshotstr | os.PathLike | Noneimage=.Returns
Example
Example
Snapshot
Returned by snapshot() · Snapshot.create() · Snapshot.open() · Snapshot.list_dir() · handle.open()
A fully-parsed snapshot artifact. Properties are read-only attributes (not async).snapshot.path
str
Path to the artifact directory
snapshot.digest
str
Canonical content digest (sha256:hex). The snapshot’s identity
snapshot.size_bytes
int \| None
Apparent size of the captured upper layer in bytes (sparse on disk), when recorded
snapshot.image_ref
str
Image reference the snapshot was taken from
snapshot.image_manifest_digest
str
OCI manifest digest of the pinned image
snapshot.state_kind
SnapshotStateKind
File-backed or checkpoint-backed state
snapshot.format
SnapshotFormat \| None
On-disk format for file-backed state
snapshot.scope
SnapshotScope
Captured state scope
snapshot.fstype
str \| None
Filesystem type for file-backed state (e.g. "ext4")
snapshot.checkpoint_id
str \| None
Checkpoint identifier for checkpoint-backed state
snapshot.checkpoint_manifest_digest
str \| None
Checkpoint manifest digest for checkpoint-backed state
snapshot.parent
str \| None
Parent snapshot’s digest, or None for a root
snapshot.created_at
str
RFC 3339 timestamp
snapshot.labels
dict[str, str]
User-supplied labels
snapshot.source_sandbox
str \| None
Best-effort source-sandbox name
Snapshot.create()
name is resolved under the default snapshots directory (~/.microsandbox/snapshots/<name>/), or under dest_dir= when given; from_sandbox= names the sandbox to capture and is required.
Parameters
namestrfrom_sandboxstrdest_dirstr | os.PathLike[str] | Nonedest_dir/<name>. Defaults to the snapshots directory.labelsdict[str, str] | NoneforceboolFalse.record_integrityboolFalse.resumablebool“resumable” snapshot (disk plus VM state). Accepted, but currently fails with an Unsupported error; resumable snapshots have not landed yet. Default False.Returns
Example
Example
Snapshot.open()
Example
Example
verify() for content checks.
Parameters
path_or_namestrReturns
Snapshot.get()
Example
Example
Parameters
name_or_digeststrReturns
Snapshot.list()
Example
Example
Returns
Snapshot.list_dir()
Parameters
dirstr | os.PathLikeReturns
Snapshot.remove()
Example
Example
force=True.
Parameters
path_or_namestrforceboolFalse.Snapshot.reindex()
Example
Example
dir (default: configured snapshots dir) and rebuild the local index. Returns the number of artifacts indexed.
Parameters
dirstr | os.PathLike | NoneReturns
Snapshot.save()
Example
Example
.tar.zst archive. The existing snapshot manifest is archived as-is; create the snapshot with recorded integrity when the archive will cross a trust boundary.
Parameters
name_or_pathstroutstr | os.PathLikewith_parentsboolFalse.with_imageboolFalse.plain_tarbool.tar instead of .tar.zst. Default False.Move artifacts
Snapshot.load()
.tar.zst or .tar) into the snapshots directory. Structural and archive-entry checks run during import; recorded payload integrity is preserved for explicit verify(). Compression is detected from magic bytes.
Parameters
archivestr | os.PathLike.tar.zst or .tar).deststr | os.PathLike | NoneReturns
Example
Example
Inspect
snap.verify()
Example
Example
not_recorded without reading payload contents when no integrity was stored.
Returns
upper.kind field is “not_recorded” when no integrity hash was stored, or “verified” with the recomputed digest.SnapshotHandle
Returned by Snapshot.get() · Snapshot.list() · Snapshot.load()
Lightweight handle backed by an index row. Properties are read-only attributes (not async).handle.digest
str
Manifest digest, canonical identity
handle.name
str \| None
Convenience alias
handle.parent_digest
str \| None
Parent snapshot digest, or None for a root
handle.image_ref
str
Image the snapshot was taken from
handle.state_kind
SnapshotStateKind
File-backed or checkpoint-backed state
handle.format
SnapshotFormat \| None
On-disk format for file-backed state
handle.scope
SnapshotScope
Captured state scope
handle.fstype
str \| None
Filesystem type for file-backed state
handle.checkpoint_manifest_digest
str \| None
Checkpoint manifest digest for checkpoint-backed state
handle.size_bytes
int \| None
Apparent upper size at index time
handle.locality
str
Artifact locality reported by the index
handle.availability
str
Artifact availability reported by the index
handle.migration_state
str
Current migration state
handle.migration_error_code
str \| None
Migration error code, when migration failed
handle.created_at
float
ms since Unix epoch
handle.path
str
Local artifact directory path
handle.open()
Example
Example
Snapshot metadata for this handle. Metadata-validated only; does not read the upper file.
Returns
handle.remove()
Example
Example
force=True.
Parameters
forceboolFalse.Types
SnapshotStateKind
Returned by Snapshot.state_kind · SnapshotHandle.state_kind
Snapshot state representation.SnapshotFormat
Returned by Snapshot.format · SnapshotHandle.format
On-disk format for file-backed snapshot state.SnapshotScope
Returned by Snapshot.scope · SnapshotHandle.scope
Captured snapshot state scope.