# Zig (/pipeline-sdk/reference/toolchains/zig)



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

## `zig` [#zig]

Callable singleton for the Zig toolchain — access as `hm.zig`.

Supports three usage forms:

* Toolchain form: `hm.zig(version="0.13.0")` returns a `ZigToolchain`
  shared across multiple projects.
* Project form: `hm.zig(path=".")` returns a `ZigProject` directly.
* Bare form: `hm.zig.build()`, `hm.zig.test()`, etc. for one-shot leaves.

```python
zig(*, path=None, version='0.13.0', image=None, base=None) -> ZigToolchain | ZigProject
```

| Parameter                                    | Type           | Default    | Description                                              |
| -------------------------------------------- | -------------- | ---------- | -------------------------------------------------------- |
| `path`                                       | `str \| None`  | `None`     | Zig project root. Omit to get a reusable `ZigToolchain`  |
| from which multiple projects can be spawned. |                |            |                                                          |
| `version`                                    | `str`          | `'0.13.0'` | Zig release version (e.g. `"0.13.0"`). Must be a         |
| full `MAJOR.MINOR.PATCH` string.             |                |            |                                                          |
| `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** `ZigToolchain | ZigProject` — A `ZigToolchain` when `path` is omitted, or a `ZigProject`

### `zig.build()` [#zigbuild]

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

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

**Returns** `Step`

### `zig.fmt()` [#zigfmt]

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

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

**Returns** `Step`

### `zig.test()` [#zigtest]

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

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

**Returns** `Step`

## `ZigEntry` [#zigentry]

Callable singleton for the Zig toolchain — access as `hm.zig`.

Supports three usage forms:

* Toolchain form: `hm.zig(version="0.13.0")` returns a `ZigToolchain`
  shared across multiple projects.
* Project form: `hm.zig(path=".")` returns a `ZigProject` directly.
* Bare form: `hm.zig.build()`, `hm.zig.test()`, etc. for one-shot leaves.

### `ZigEntry.build()` [#zigentrybuild]

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

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

**Returns** `Step`

### `ZigEntry.fmt()` [#zigentryfmt]

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

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

**Returns** `Step`

### `ZigEntry.test()` [#zigentrytest]

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

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

**Returns** `Step`

## `ZigProject` [#zigproject]

Zig project rooted on a specific path — constructed via `hm.zig(path=...)`.

`installed` is the zig-install step. Action methods (`build`,
`test`, `fmt`) attach leaves to `installed`.

### Fields [#fields]

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

### `ZigProject.build()` [#zigprojectbuild]

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

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

**Returns** `Step`

### `ZigProject.fmt()` [#zigprojectfmt]

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

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

**Returns** `Step`

### `ZigProject.test()` [#zigprojecttest]

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

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

**Returns** `Step`

## `ZigToolchain` [#zigtoolchain]

Zig toolchain install chain — constructed via `hm.zig()` with no `path`.

Holds the shared zig-install step. Spawn one `ZigProject` per
subdirectory via `.project(path)`; all projects from one toolchain
share the same install step, so the emitted IR contains a single
`:zig: install` node fanned out to N project chains.

### Fields [#fields-1]

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

### `ZigToolchain.project()` [#zigtoolchainproject]

```python
project(path='.') -> ZigProject
```

Create a `ZigProject` rooted at `path` from this toolchain.

| Parameter | Type  | Default | Description                                             |
| --------- | ----- | ------- | ------------------------------------------------------- |
| `path`    | `str` | `'.'`   | Path to the Zig project root relative to the workspace. |

**Returns** `ZigProject` — A `ZigProject` whose `installed` step is shared with this

**Examples**

```python
>>> import harmont as hm
>>> tc = hm.zig(version="0.13.0")
>>> lib = tc.project("lib-a")
>>> app = tc.project("app")
>>> hm.pipeline(lib.test(), app.test())
```
