---
title: CostReport
description: Per-phase attribution for one sandbox, measured or projected.
---

```python
@final
class CostReport
```

Per-phase attribution for one sandbox, measured or projected.

## Constructor

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

## Properties

### `complete`

```python
complete: bool
```

False whenever any phase has no published rate.

### `fully_measured`

```python
fully_measured: bool
```

True only if every duration was timed. An estimate is never this.

### `items`

```python
items: list[LineItem]
```

### `label`

```python
label: str
```

### `priced`

```python
priced: list[LineItem]
```

The line items with a published rate.

### `rates`

```python
rates: RateTable
```

### `size`

```python
size: SizeClass
```

### `staleness`

```python
staleness: str | None
```

The staleness warning the table carried when this was computed.

### `total`

```python
total: Total
```

The total, which is a lower bound whenever anything is unpriced.

### `unpriced`

```python
unpriced: list[LineItem]
```

The line items with no published rate.

## Methods

### `by_phase`

```python
def by_phase(phase: str) -> list[LineItem]
```

The line items belonging to one phase.

The string is judged by the core's own \[`CostPhase::from_str`], which is where the
closed set lives. This module used to carry its own seven-element table for it — a
parallel list over an enum, which would have gone stale the first time a phase was
added and would have disagreed with the JS binding's identical copy in whichever
direction was edited first.

### `render`

```python
def render() -> str
```

Plain text, leading with what the dollars are rather than with the dollars.

### `to_dict`

```python
def to_dict() -> dict
```

Core's JSON shape for a report, as a dict: the one `microvm cost --json` and
TypeScript's `toJson` emit (#255).

## Special methods

### `__repr__`

```python
def __repr__() -> str
```

### `__str__`

```python
def __str__() -> str
```

## 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.