Skip to content

Amount

@final
class Amount

What a line item’s cost can be: an estimate, or unpriced.

A class rather than a union, because a union in Python is a documentation convention and this has to be something a caller can branch on. kind is the stable tag ("estimated-usd" / "unpriced"), usd is None for the unpriced case, and unpriced is None for the priced one — so exactly one of the two is present and a reader who checks either has handled both.

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

kind: str

"estimated-usd" or "unpriced" — the tag cli.py puts in amount.kind.

unpriced: Unpriced | None

The unpriced half, or None when the line was priced.

usd: EstimatedUsd | None

The estimate, or None when there is no published rate.

None rather than a zero, which is the same decision as the JSON omitting the usd key: a zero gets summed by anything permissive, and that is the one arithmetic this module refuses to enable.

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.