@finalclass EstimatedUsdDollars derived from published rates. Not the bill.
There is no way to get a number out of this
No __float__, no __int__, no __index__, no __add__. [Self::amount] answers a
string — the decimal figure at full precision — so float(usd) raises
TypeError, usd + usd raises TypeError, and the cheapest laundering spelling
(f"${float(x):.2f}") does not run. The core makes this a compile error; the closest
Python equivalent is an absence, and this is it.
A caller who genuinely needs arithmetic writes Decimal(usd.amount), which is one
visible step, keeps the type name at the call site, and is a decision a reviewer sees.
Constructor
Section titled “Constructor”EstimatedUsd declares no __new__ or __init__, so it is not constructed directly: an instance comes back from another call in this package.
Properties
Section titled “Properties”amount
Section titled “amount”amount: strThe figure as an exact decimal string.
A string and not a float, which is the whole of COST-2 at this boundary. The core
carries a rust_decimal::Decimal and the exact spelling of it is what survives
into Decimal(...) on the Python side; an f64 would already have lost the
exactness the type exists to hold.
display_amount
Section titled “display_amount”display_amount: strThe figure at display precision: two places at a dollar or more, six below.
A create-and-destroy suite’s compute cost lives in the sixth decimal place while a warm pool’s monthly bill lives in the second, and one fixed precision cannot show both.
Special methods
Section titled “Special methods”__repr__
Section titled “__repr__”def __repr__() -> str__str__
Section titled “__str__”def __str__() -> str~$X (estimated) — the label travels with the figure, because a number copied out
of a terminal loses its docstring.
Provenance
Section titled “Provenance”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.