99from usethis ._console import how_print , info_print , instruct_print
1010from usethis ._file .pyproject_toml .io_ import PyprojectTOMLManager
1111from usethis ._tool .base import Tool
12- from usethis ._tool .impl .base .codespell import CodespellTool
13- from usethis ._tool .impl .base .coverage_py import CoveragePyTool
14- from usethis ._tool .impl .base .deptry import DeptryTool
15- from usethis ._tool .impl .base .import_linter import ImportLinterTool
16- from usethis ._tool .impl .base .mkdocs import MkDocsTool
17- from usethis ._tool .impl .base .pre_commit import PreCommitTool
18- from usethis ._tool .impl .base .pyproject_fmt import PyprojectFmtTool
19- from usethis ._tool .impl .base .pytest import PytestTool
20- from usethis ._tool .impl .base .requirements_txt import RequirementsTxtTool
21- from usethis ._tool .impl .base .ruff import RuffTool
22- from usethis ._tool .impl .base .tach import TachTool
23- from usethis ._tool .impl .base .ty import TyTool
12+ from usethis ._tool .heuristics import is_likely_used
13+ from usethis ._tool .impl .spec .all_ import ALL_TOOL_SPECS
2414from usethis ._tool .impl .spec .pyproject_toml import PyprojectTOMLToolSpec
2515
26- # N.B. this list must be kept in-sync with usethis._tool.all_.ALL_TOOLS.
27- OTHER_TOOLS : list [Tool ] = [
28- CodespellTool (),
29- CoveragePyTool (),
30- DeptryTool (),
31- ImportLinterTool (),
32- MkDocsTool (),
33- PreCommitTool (),
34- PyprojectFmtTool (),
35- PytestTool (),
36- RequirementsTxtTool (),
37- RuffTool (),
38- TachTool (),
39- TyTool (),
40- ]
41-
4216
4317@final
4418class PyprojectTOMLTool (PyprojectTOMLToolSpec , Tool ):
@@ -61,14 +35,17 @@ def remove_managed_files(self) -> None:
6135
6236 instruct_print ("Check that important config in 'pyproject.toml' is not lost." )
6337
64- for tool in OTHER_TOOLS :
38+ for tool_spec in ALL_TOOL_SPECS :
39+ if isinstance (tool_spec , PyprojectTOMLToolSpec ):
40+ continue
6541 if (
66- tool .is_used ()
67- and PyprojectTOMLManager () in tool .get_active_config_file_managers ()
42+ is_likely_used (tool_spec )
43+ and PyprojectTOMLManager ()
44+ in tool_spec .get_active_config_file_managers ()
6845 ):
6946 # Warn the user
7047 instruct_print (
71- f"The { tool .name } tool was using 'pyproject.toml' for config, "
48+ f"The { tool_spec .name } tool was using 'pyproject.toml' for config, "
7249 f"but that file is being removed. You will need to re-configure it."
7350 )
7451
0 commit comments