Skip to content

SizeClass

@final
class SizeClass

One of the five documented size classes.

minimumMemoryInMiB selects a class; it does not size a VM. Both numbers are on the class or neither, because naming only the peak invites budgeting for memory nobody is billed for and naming only the baseline invites a pressure test against a ceiling four times too low.

SizeClass declares no __new__ or __init__, so it is not constructed directly: an instance comes back from another call in this package.

baseline_gb: float

The figure a GB-second rate multiplies. Always the baseline, never the peak.

baseline_mib: int
baseline_vcpu: float
peak_gb: float

The peak in GB, which is what the guest reports as MemTotal.

peak_mib: int
peak_vcpu: float
@staticmethod
def all() -> list[SizeClass]

Every class, smallest first.

@staticmethod
def default_class() -> SizeClass

The platform’s default, 2048 MiB. Not the smallest — a 0.5 GB baseline fixes the guest’s always-present ceiling at 2 GB, which OOM-kills a real test suite, and the guest has no swap.

def describe() -> str

One line naming both numbers. cli.py calls this describe().

@staticmethod
def from_baseline_mib(mib: SupportsIndex) -> SizeClass

The class minimumMemoryInMiB = mib selects, or a refusal (TRAP-10).

Off-table figures are refused rather than snapped to a neighbour: the two plausible readings differ in both memory and rate, and neither has been measured.

@staticmethod
def from_request(
cpus: SupportsFloat | SupportsIndex | None = None,
memory_mib: SupportsIndex | None = None,
) -> SizeClass

The smallest class whose baseline covers a resource request (BIND-14).

cpus in vCPUs and memory_mib in MiB, each a request; None or zero is no requirement on that axis, and with none on either the answer is default_class(). Chosen by baseline, the billed and always-present figure. Raises InvalidArgError naming the largest class when no class covers the request, or for a CPU figure that is not a finite non-negative number.

def __repr__() -> str
def __str__() -> str

This page is generated from bindings/microvms-py/microvms.pyi by Griffe 2.3.0, run from site/scripts/gen-reference.mjs on every pnpm run sync, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding’s Rust source, then regenerate the declarations with mise run stubs. mise run stubs:check fails when the committed file no longer matches the source.