-
Notifications
You must be signed in to change notification settings - Fork 3
Fatal crash on usethis tool import-linter for empty src dir #1226
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
for https://github.com/pypest/pyemu/tree/migrate_uv/pyemu
Details
uvx usethis tool import-linter
✔ Adding dependency 'import-linter' to the 'dev' group in 'pyproject.toml'.
⚠ Could not find any importable packages.
⚠ Assuming the package name is pyemu.
╭──────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────╮
│ C:\Users\namc\AppData\Local\uv\cache\archive-v0\w6T56ykrY7K3wv_iBpmjD\Lib\site-packages\usethis\_ui\interface\tool.py:136 in import_linter │
│ │
│ 133 │ │ ), ╭─────────────── locals ───────────────╮ │
│ 134 │ │ files_manager(), │ backend = <BackendEnum.auto: 'auto'> │ │
│ 135 │ ): │ frozen = False │ │
│ ❱ 136 │ │ _run_tool(use_import_linter, remove=remove, how=how) │ how = False │ │
│ 137 │ offline = False │ │
│ 138 │ quiet = False │ │
│ 139 @app.command( │ remove = False │ │
│ ╰──────────────────────────────────────╯ │
│ │
│ C:\Users\namc\AppData\Local\uv\cache\archive-v0\w6T56ykrY7K3wv_iBpmjD\Lib\site-packages\usethis\_ui\interface\tool.py:339 in _run_tool │
│ │
│ 336 │ from usethis.errors import UsethisError ╭──── locals ────╮ │
│ 337 │ │ how = False │ │
│ 338 │ try: │ kwargs = {} │ │
│ ❱ 339 │ │ caller(remove=remove, how=how, **kwargs) │ remove = False │ │
│ 340 │ except UsethisError as err: ╰────────────────╯ │
│ 341 │ │ err_print(err) │
│ 342 │ │ raise typer.Exit(code=1) from None │
│ │
│ C:\Users\namc\AppData\Local\uv\cache\archive-v0\w6T56ykrY7K3wv_iBpmjD\Lib\site-packages\usethis\_core\tool.py:143 in use_import_linter │
│ │
│ 140 │ │ ensure_dep_declaration_file() │
│ 141 │ │ │
│ 142 │ │ tool.add_dev_deps() │
│ ❱ 143 │ │ tool.add_configs() │
│ 144 │ │ if RuffTool().is_used(): │
│ 145 │ │ │ RuffTool().apply_rule_config(rule_config) │
│ 146 │ │ if PreCommitTool().is_used(): │
│ │
│ ╭─────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────╮ │
│ │ how = False │ │
│ │ remove = False │ │
│ │ rule_config = RuleConfig(selected=[], ignored=[], unmanaged_selected=['INP'], unmanaged_ignored=[], tests_unmanaged_ignored=['INP']) │ │
│ │ tool = <usethis._tool.impl.import_linter.ImportLinterTool object at 0x00000151BFACEFD0> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\namc\AppData\Local\uv\cache\archive-v0\w6T56ykrY7K3wv_iBpmjD\Lib\site-packages\usethis\_tool\base.py:421 in add_configs │
│ │
│ 418 │ │ # In practice, the most common resolution method is "first", in which case there │
│ 419 │ │ # is only ever one active file; so principles #2 and #3 are not relevant. │
│ 420 │ │ │
│ ❱ 421 │ │ active_config_file_managers = self.get_active_config_file_managers() │
│ 422 │ │ │
│ 423 │ │ already_added = False # Only print messages for the first added config item. │
│ 424 │ │ for config_item in self.get_config_spec().config_items: │
│ │
│ ╭──────────────────────────────────────── locals ─────────────────────────────────────────╮ │
│ │ self = <usethis._tool.impl.import_linter.ImportLinterTool object at 0x00000151BFACEFD0> │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\namc\AppData\Local\uv\cache\archive-v0\w6T56ykrY7K3wv_iBpmjD\Lib\site-packages\usethis\_tool\base.py:322 in get_active_config_file_managers │
│ │
│ 319 │ │
│ 320 │ def get_active_config_file_managers(self) -> set[KeyValueFileManager]: │
│ 321 │ │ """Get relative paths to all active configuration files.""" │
│ ❱ 322 │ │ config_spec = self.get_config_spec() │
│ 323 │ │ resolution = config_spec.resolution │
│ 324 │ │ return self._get_active_config_file_managers_from_resolution( │
│ 325 │ │ │ resolution, │
│ │
│ ╭──────────────────────────────────────── locals ─────────────────────────────────────────╮ │
│ │ self = <usethis._tool.impl.import_linter.ImportLinterTool object at 0x00000151BFACEFD0> │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\namc\AppData\Local\uv\cache\archive-v0\w6T56ykrY7K3wv_iBpmjD\Lib\site-packages\usethis\_tool\impl\import_linter.py:162 in get_config_spec │
│ │
│ 159 │ │ │ │ contracts.append(contract) │
│ 160 │ │ │
│ 161 │ │ if not contracts: │
│ ❱ 162 │ │ │ raise AssertionError │
│ 163 │ │ │
│ 164 │ │ def get_root_packages() -> list[str] | NoConfigValue: │
│ 165 │ │ │ # There are two configuration items which are very similar: │
│ │
│ ╭───────────────────────────────────────────────────────────── locals ──────────────────────────────────────────────────────────────╮ │
│ │ contracts = [] │ │
│ │ layered_architecture_by_module = {} │ │
│ │ layered_architecture_by_module_by_root_package = {'pyemu': {}} │ │
│ │ min_depth = 0 │ │
│ │ self = <usethis._tool.impl.import_linter.ImportLinterTool object at 0x00000151BFACEFD0> │ │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AssertionError
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working