# How to use ty in CI


[ty](https://pydevtools.com/handbook/reference/ty.md) can run in CI with no installation step beyond [uv](https://pydevtools.com/handbook/reference/uv.md). Because ty is a single binary with no runtime dependencies, it adds minimal overhead to your pipeline.

## GitHub Actions

The simplest approach uses `uvx` to run ty without adding it as a project dependency:

```yaml
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- run: uvx ty check src/
```

To get inline annotations on pull requests, use the `github` output format:

```yaml
- run: uvx ty check src/ --output-format github
```

This produces GitHub-native annotations that appear directly on changed lines in the pull request diff.

## GitLab CI

GitLab has a corresponding annotation format:

```yaml
type-check:
  script:
    - uvx ty check src/ --output-format gitlab
```

## Output formats

ty supports four output formats, selected with `--output-format`:

| Format | Use case |
|---|---|
| `full` (default) | Local development. Multi-line diagnostics with code context. |
| `concise` | Log parsing and scripting. One line per error. |
| `github` | GitHub Actions annotations. |
| `gitlab` | GitLab CI annotations. |

```bash
ty check --output-format concise
```

## Pin ty so a new release can't break your build

ty ships releases roughly weekly and is still pre-1.0 (0.0.51 as of June 2026). Its diagnostics can change between any two versions, so an unpinned `uvx ty check` can start failing on a run where none of your code changed.

Pin the version in CI to keep results stable:

```yaml
- run: uvx ty@0.0.51 check src/
```

When you want a newer release's checks, bump the pin in its own commit. The diagnostic changes then arrive as a reviewable diff instead of a surprise red build on unrelated work.

If your team can't absorb periodic pin bumps, a type checker that has already reached 1.0 trades ty's speed for version stability. See [ty vs Pyrefly](https://pydevtools.com/handbook/explanation/ty-vs-pyrefly.md) and [when to choose each checker](https://pydevtools.com/handbook/explanation/how-do-mypy-pyright-and-ty-compare.md#when-to-choose-each).

## Running alongside Ruff

If you already use [Ruff](https://pydevtools.com/handbook/reference/ruff.md) in CI, add ty as a separate step:

```yaml
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- run: uvx ruff check .
- run: uvx ruff format --check .
- run: uvx ty check src/
```

## Learn more

- [How to try the ty type checker](https://pydevtools.com/handbook/how-to/how-to-try-the-ty-type-checker.md)
- [How to migrate from mypy to ty](https://pydevtools.com/handbook/how-to/how-to-migrate-from-mypy-to-ty.md)
- [How do mypy, pyright, and ty compare?](https://pydevtools.com/handbook/explanation/how-do-mypy-pyright-and-ty-compare.md)
