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:
pip install ty# oruv tool install tyExamples
tyc ty # one-shottyc ty --out build/ # explicit out dirtyc ty --watch # re-runs on .ty / .dty changestyc 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
| Flag | Effect |
|---|---|
--out DIR | Write emitted Python here instead of a temp dir. |
--ty-bin BIN | Path to the ty executable (default: ty). |
--no-build | Skip the build step; requires --out. |
--watch | Watch source and re-run on .ty / .dty changes. |
--raw | Forward 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 -- --strictty 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 —
tyitself 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
tyc check— Typhon’s own checker (always run first).tyc stubtest— runtime stub introspection.- docs/ty-integration.md (canonical plan) — the longer plan for
tyintegration as an embedded library.