Replace hand-written ty machinery with the official ty-pre-commit hook#133
Open
hmgaudecker wants to merge 1 commit into
Open
Replace hand-written ty machinery with the official ty-pre-commit hook#133hmgaudecker wants to merge 1 commit into
hmgaudecker wants to merge 1 commit into
Conversation
ty now runs only as pre-commit hooks, under both backends: - numpy: official astral-sh/ty-pre-commit hook with `--no-project`, so uv creates no `.venv`/`uv.lock`; ty resolves third-party imports from the pixi `py314` environment via `tool.ty.environment.python`. - jax: a minimal local hook running the same pinned ty with `--python .pixi/envs/py314-jax`, inheriting the full `tool.ty` configuration. A local hook is needed because `uv check` does not forward any flags to ty. The dedicated `type-checking`/`type-checking-jax` pixi features, environments, and tasks are removed; the existing test environments provide everything ty needs. The `run-ty` CI job runs the hooks via prek. Both hooks are skipped on pre-commit.ci (no network at hook runtime, no pixi environments). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ty now runs only as pre-commit hooks, under both backends, replacing the dedicated pixi
type-checking/type-checking-jaxfeatures, environments, and tasks (pixi run ty/pixi run ty-jaxno longer exist).args: [--no-project]. uv creates no.venv/uv.lockin this pixi-managed repo and resolves no dependencies itself (its default mode fails on the pygraphviz source build anyway); ty resolves third-party imports from the pixipy314environment viatool.ty.environment.pythoninpyproject.toml.--python .pixi/envs/py314-jax. It inherits the entiretool.tyconfiguration — same rules, only the environment differs. Verified that jax genuinely resolves in this run (passes even with jax dropped fromanalysis.allowed-unresolved-imports).The jax variant cannot use the official hook today:
uv checkforwards nothing to ty (no--python, no-c, no trailing args), and ty rejects conda-style envs handed over viaVIRTUAL_ENV(nopyvenv.cfg). The local hook'sty==0.0.48pin carries a comment to keep it in sync with the hook rev, sinceprek auto-updatebumps only the rev.Other changes
run-tyCI job installspy314/py314-jaxand runs the hooks via prek, so the pre-commit config is the single definition of how ty runs everywhere.pixi.lock. pixi 0.70.2 does not prune removed environments from the lock; the stale blocks and orphanedtypackage entries were removed manually and the result validated withpixi lock.prek run --all-filescovers type checking under both backends.Test plan
pixi run -e py314-jax prek run --all-files— all hooks pass, including both ty variantspixi run --locked -e py314 prek run ty --all-filesand... ty-jax --all-files(exact CI commands)pixi run --locked -e py314-jax tests -n 7— 1119 passed, 42 skippedpixi lock— lock file validates after pruning🤖 Generated with Claude Code