Implement usethis tool ty and usethis typecheck#1446
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Merging this PR will degrade performance by 6.45%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| 👁 | Simulation | test_help_flag |
34.2 ms | 36.6 ms | -6.45% |
Comparing 838-implement-usethis-tool-ty2 (b66dce8) with main (6edd7ec)
Add `--typecheck` support to `usethis init`
There was a problem hiding this comment.
Pull request overview
Adds first-class support for the Astral ty type checker as a managed tool, and introduces a higher-level usethis typecheck command for adding/removing recommended type checking tooling (currently ty). This integrates ty into init flows, tool listing, pre-commit ordering, CI integration, and project configuration management.
Changes:
- Implement
usethis tool ty+ coreuse_ty()plumbing, including deps/pre-commit/Bitbucket integration and config discovery. - Add
usethis typecheck(toolset wrapper) and wire it intousethis init --typecheck/--no-typecheck. - Update docs/tests and bump a few tool/version constants (pyproject-fmt, codespell, ruff, uv fallback).
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/usethis/_ui/interface/test_typecheck.py | New CLI interface tests for usethis typecheck behavior/output. |
| tests/usethis/_ui/interface/test_tool.py | Adds interface tests for usethis tool ty add/how/remove. |
| tests/usethis/_ui/interface/test_init.py | Updates init output expectations and pre-commit hook order to include ty. |
| tests/usethis/_tool/impl/base/test_ty.py | New unit tests for TyTool behavior (cmd selection, config spec, pre-commit config, usage detection). |
| tests/usethis/_core/test_list.py | Ensures usethis list includes ty in usage table rows. |
| tests/usethis/_core/test_core_tool.py | Adds core use_ty() tests + registers ty in tool name regression set. |
| src/usethis/_ui/interface/typecheck.py | New typecheck CLI command implementation. |
| src/usethis/_ui/interface/tool.py | Adds ty subcommand under usethis tool and registers "ty" in command list. |
| src/usethis/_ui/interface/init.py | Adds --typecheck/--no-typecheck option and wires into init workflow. |
| src/usethis/_ui/app.py | Registers usethis typecheck command. |
| src/usethis/_toolset/typecheck.py | New toolset wrapper use_typecheckers() (currently delegates to use_ty). |
| src/usethis/_tool/impl/spec/ty.py | New Ty tool spec: deps, config resolution across pyproject/ty.toml/.ty.toml, pre-commit config. |
| src/usethis/_tool/impl/spec/pyproject_fmt.py | Bumps _PYPROJECT_FMT_VERSION. |
| src/usethis/_tool/impl/spec/codespell.py | Bumps _CODESPELL_VERSION. |
| src/usethis/_tool/impl/base/ty.py | New TyTool implementation with custom “how to use” output. |
| src/usethis/_tool/impl/base/ruff.py | Bumps _RUFF_VERSION. |
| src/usethis/_tool/impl/base/pyproject_toml.py | Registers TyTool() in OTHER_TOOLS for pyproject peer detection. |
| src/usethis/tool/all.py | Adds TyTool to SupportedToolType and ALL_TOOLS. |
| src/usethis/_integrations/pre_commit/hooks.py | Adds "ty" to known hook IDs ordering list. |
| src/usethis/_core/tool.py | Implements use_ty() and updates use_tool() dispatch. |
| src/usethis/_config_file.py | Adds TOML managers for .ty.toml and ty.toml, and registers them with files_manager(). |
| src/usethis/_backend/uv/version.py | Bumps FALLBACK_UV_VERSION. |
| docs/cli/reference.md | Documents usethis typecheck and adds usethis tool ty to tool list. |
| docs/cli/overview.md | Adds usethis typecheck and usethis tool ty to CLI overview. |
| README.md | Adds usethis typecheck / usethis tool ty references; updates “planned features” section. |
| CONTRIBUTING.md | Updates contributor guidance to mention registering new tools in PyprojectTOMLTool peer list and updating list tests. |
| .importlinter | Updates layer contracts to include ty and typecheck. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.