Update print_how_to_use for all tools to use new `get_install_metho…#814
Merged
nathanjmcdougall merged 4 commits intomainfrom Jun 28, 2025
Conversation
…d` method for determining the approach to recommend for using the tool
CodSpeed WallTime Performance ReportMerging #814 will not alter performanceComparing Summary
|
…o_use` (i.e. prefer using directly rather than via pre-commit; less verbose and more consistent behaviour viz. other tools)
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the print_how_to_use methods across multiple tools to use the new get_install_method approach for determining the recommended usage. In addition, the tests have been updated to use more explicit pre-commit config content rather than merely touching files.
- Updated test files with explicit pre-commit YAML configurations.
- Updated tool implementation files (Ruff, RequirementsTxt, PyprojectFmt, ImportLinter, Deptry) to use the get_install_method result.
- Adjusted expected command output strings in core tests to match the new command format.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/usethis/_tool/impl/test_requirements_txt.py | Uses write_text for generating explicit pre-commit config YAML. |
| tests/usethis/_tool/impl/test_import_linter.py | Updates pre-commit config generation for the import linter tool. |
| tests/usethis/_core/test_core_tool.py | Adjusts expected output for the import-linter command message. |
| tests/usethis/_core/test_core_ci.py | Replaces file touches with explicit configuration content. |
| src/usethis/_tool/impl/ruff.py | Refactors print_how_to_use to use get_install_method for command logic. |
| src/usethis/_tool/impl/requirements_txt.py | Implements new installation method detection in print_how_to_use. |
| src/usethis/_tool/impl/pyproject_fmt.py | Uses get_install_method to change how commands are printed. |
| src/usethis/_tool/impl/import_linter.py | Applies new get_install_method logic to determine command output. |
| src/usethis/_tool/impl/deptry.py | Updates print_how_to_use to incorporate new installation method logic. |
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.
…d` method for determining the approach to recommend for using the tool