Skip to content

Implement usethis tool ty and usethis typecheck#1446

Merged
nathanjmcdougall merged 11 commits intomainfrom
838-implement-usethis-tool-ty2
Mar 22, 2026
Merged

Implement usethis tool ty and usethis typecheck#1446
nathanjmcdougall merged 11 commits intomainfrom
838-implement-usethis-tool-ty2

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

No description provided.

@nathanjmcdougall nathanjmcdougall linked an issue Mar 21, 2026 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 97.63780% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/usethis/_ui/interface/typecheck.py 81.25% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 21, 2026

Merging this PR will degrade performance by 6.45%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 (👁 1) regressed benchmark
✅ 1 untouched benchmark

Performance Changes

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)

Open in CodSpeed

Add `--typecheck` support to `usethis init`
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + core use_ty() plumbing, including deps/pre-commit/Bitbucket integration and config discovery.
  • Add usethis typecheck (toolset wrapper) and wire it into usethis 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@nathanjmcdougall nathanjmcdougall merged commit 5fe0bc4 into main Mar 22, 2026
19 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 838-implement-usethis-tool-ty2 branch March 22, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement usethis tool ty

2 participants