# Pipeline SDK (/pipeline-sdk)



A Harmont pipeline is a small program. You import the SDK, build a graph of
shell steps, and register it so the CLI can find it. You write pipelines as
Python or TypeScript programs rather than YAML, and `hm` runs them.

The same pipeline can be written in Python or TypeScript. Pick a language with
the switch on any code sample; your choice follows you across the docs.

**Python**

```python title=".hm/pipeline.py"
import harmont as hm

@hm.pipeline("ci", triggers=[hm.push(branch="main")])
def ci() -> tuple[hm.Step, ...]:
    project = hm.rust.toolchain(path=".")
    return (project.build(), project.test())
```

**TypeScript**

```typescript title=".hm/pipeline.ts"
import { pipeline, push, type PipelineDefinition } from "@harmont/hm";
import { rust } from "@harmont/hm/toolchains";

const project = rust.toolchain({ path: "." });

const pipelines: PipelineDefinition[] = [
  {
    slug: "ci",
    triggers: [push({ branch: "main" })],
    pipeline: pipeline([project.build(), project.test()]),
  },
];

export default pipelines;
```

## Install [#install]

Install the SDK for your language so your editor gives you types and
autocomplete as you write pipelines.

**Python**

```bash
pip install harmont
# or: uv add harmont
```

**TypeScript**

```bash
npm install @harmont/hm
# or: pnpm add @harmont/hm
# or: bun add @harmont/hm
```

## Where to go next [#where-to-go-next]

<Cards>
  <Card title="Chains & steps" href="/pipeline-sdk/chains" description="The Step primitive, forking, and waits — how the graph is built." />

  <Card title="Toolchains" href="/pipeline-sdk/toolchains" description="Install, build, and test for Rust, Python, Go, Node, CMake, and more." />

  <Card title="Caching" href="/pipeline-sdk/caching" description="TTL, on-change, and forever cache policies." />

  <Card title="Triggers" href="/pipeline-sdk/triggers" description="Run pipelines on push or pull request." />

  <Card title="Reference" href="/pipeline-sdk/reference" description="Every public function, class, and toolchain, generated from the source." />
</Cards>
