# Python (/pipeline-sdk/reference/toolchains/python)



{/* Generated by docs-site/scripts/generate-dsl-docs.ts — do not edit. */}

## `python` [#python]

Callable singleton for the Python (uv) toolchain — access as `hm.python`.

Call directly to construct a `PythonToolchain`, or use the bare-form
action methods (`python.test()`, `python.lint()`, etc.) for a
one-shot leaf.

```python
python(*, path='.', uv_version='latest', image=None, base=None) -> PythonToolchain
```

| Parameter                                           | Type           | Default    | Description                                              |
| --------------------------------------------------- | -------------- | ---------- | -------------------------------------------------------- |
| `path`                                              | `str`          | `'.'`      | Path to the Python project root (must contain a          |
| `pyproject.toml`).                                  |                |            |                                                          |
| `uv_version`                                        | `str`          | `'latest'` | uv version to install. Use `"latest"` for the            |
| latest release or a pinned version like `"0.4.18"`. |                |            |                                                          |
| `image`                                             | `str \| None`  | `None`     | Local-mode Docker base image override.                   |
| `base`                                              | `Step \| None` | `None`     | Existing `Step` to attach to instead of emitting a fresh |
| apt-base step.                                      |                |            |                                                          |

**Returns** `PythonToolchain` — A `PythonToolchain` whose `installed` step is `uv sync`.

### `python.fmt()` [#pythonfmt]

```python
fmt(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `python.lint()` [#pythonlint]

```python
lint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `python.test()` [#pythontest]

```python
test(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `python.typecheck()` [#pythontypecheck]

```python
typecheck(*, paths=None, **kw) -> Step
```

| Parameter | Type                       | Default | Description |
| --------- | -------------------------- | ------- | ----------- |
| `paths`   | `str \| list[str] \| None` | `None`  | —           |
| `kw`      | `Any`                      | `{}`    | —           |

**Returns** `Step`

## `PythonEntry` [#pythonentry]

Callable singleton for the Python (uv) toolchain — access as `hm.python`.

Call directly to construct a `PythonToolchain`, or use the bare-form
action methods (`python.test()`, `python.lint()`, etc.) for a
one-shot leaf.

### `PythonEntry.fmt()` [#pythonentryfmt]

```python
fmt(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `PythonEntry.lint()` [#pythonentrylint]

```python
lint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `PythonEntry.test()` [#pythonentrytest]

```python
test(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `PythonEntry.typecheck()` [#pythonentrytypecheck]

```python
typecheck(*, paths=None, **kw) -> Step
```

| Parameter | Type                       | Default | Description |
| --------- | -------------------------- | ------- | ----------- |
| `paths`   | `str \| list[str] \| None` | `None`  | —           |
| `kw`      | `Any`                      | `{}`    | —           |

**Returns** `Step`

## `PythonToolchain` [#pythontoolchain]

Python (uv) toolchain install chain — constructed via `hm.python()`.

`installed` is the `uv sync` step. Action methods (`test`,
`lint`, `fmt`, `typecheck`) attach leaves to `installed` so
dependency installation is shared across CI actions.

### Fields [#fields]

| Field       | Type   | Default    |
| ----------- | ------ | ---------- |
| `path`      | `str`  | *required* |
| `installed` | `Step` | *required* |

### `PythonToolchain.fmt()` [#pythontoolchainfmt]

```python
fmt(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `PythonToolchain.lint()` [#pythontoolchainlint]

```python
lint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `PythonToolchain.test()` [#pythontoolchaintest]

```python
test(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `PythonToolchain.typecheck()` [#pythontoolchaintypecheck]

```python
typecheck(*, paths=None, **kw) -> Step
```

| Parameter | Type                       | Default | Description |
| --------- | -------------------------- | ------- | ----------- |
| `paths`   | `str \| list[str] \| None` | `None`  | —           |
| `kw`      | `Any`                      | `{}`    | —           |

**Returns** `Step`
