---
title: LineItem
description: "One phase's one billing line: what was consumed, and what that costs."
---

```python
@final
class LineItem
```

One phase's one billing line: what was consumed, and what that costs.

`quantity` is a string for the same reason `EstimatedUsd.amount` is: division by 730
hours yields 28 significant digits and the exact figure is what lets a reader check
the arithmetic against the rate table, which is the only defence against a rate that
drifts without anyone noticing.

## Constructor

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

## Properties

### `amount`

```python
amount: Amount
```

### `display_quantity`

```python
display_quantity: str
```

The quantity at display precision, for a column a human scans.

### `duration`

```python
duration: Duration | None
```

### `line`

```python
line: str | None
```

The AWS billing line, or `None` for a phase with no published rate to attribute
it to.

### `note`

```python
note: str
```

### `phase`

```python
phase: str
```

The lifecycle phase, as the Python `StrEnum` spells it.

### `quantity`

```python
quantity: str
```

The consumed quantity, exact, as a string.

### `unit`

```python
unit: str
```

## Methods

### `to_dict`

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

Core's JSON shape for a line item, as a dict. An unpriced line has **no** `usd` key at
all.

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