Skip to content

tyc ty

tyc ty [PATH] [--out DIR] [--ty-bin BIN] [--no-build] [--watch] [--raw] [-- TY_FLAGS...]

Builds the project and runs Astral’s ty type checker against the emitted Python. Useful as a second-opinion typing pass for the corners of the typing spec Typhon’s checker doesn’t try to cover.

Requires ty to be installed separately:

Terminal window
pip install ty
# or
uv tool install ty

Examples

Terminal window
tyc ty # one-shot
tyc ty --out build/ # explicit out dir
tyc ty --watch # re-runs on .ty / .dty changes
tyc ty -- --strict # forward flags to `ty check`
tyc ty --raw # forward ty's output verbatim (no .py → .ty re-attribution)

What it covers

Typhon’s checker enforces the Typhon-specific rules (non-null defaults, Result[T, E], sealed unions, let/mut, no implicit Any). tyc ty covers the standard typing-spec corners that Typhon’s checker doesn’t try to match ty / Pyrefly on:

  • Higher-kinded type interactions.
  • Variance edge cases.
  • TypedDict, NamedTuple, Generic-class subtleties.
  • Stubs from third-party packages (in your venv).

It’s complementary to tyc check, not a replacement.

Flags

FlagEffect
--out DIRWrite emitted Python here instead of a temp dir.
--ty-bin BINPath to the ty executable (default: ty).
--no-buildSkip the build step; requires --out.
--watchWatch source and re-run on .ty / .dty changes.
--rawForward ty’s output verbatim. By default path.py:line[:col] prefixes are rewritten to the originating .ty location via the .py.map sidecars.

Anything after -- is forwarded to ty check verbatim.

CI integration

- name: Type-check with ty
run: tyc ty -- --strict

ty is fast (sub-second on small projects), so adding it to CI costs little.

Exit codes

tyc ty propagates ty’s exit code:

  • 0 — clean.
  • 1 — typing errors found.
  • 2 — ty itself failed (missing binary, bad invocation).

What if ty isn’t installed?

tyc ty prints a clear “install ty” message and exits 1. It does not silently skip the check.

Where next