Skip to content

fix: enable proper mypy checking for idc_index_data_manager.py#144

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-mypy-checking-idc-index-data-manager
Draft

fix: enable proper mypy checking for idc_index_data_manager.py#144
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-mypy-checking-idc-index-data-manager

Conversation

Copilot AI commented May 8, 2026

Copy link
Copy Markdown
Contributor

scripts/python/idc_index_data_manager.py was invisible to mypy because the pre-commit hook's files pattern only matched src|tests. A single combined pattern caused a "source file found twice" error — mypy resolves the file as idc_index_data_manager when passed directly, but as scripts.python.idc_index_data_manager when followed via test imports.

Changes

  • .pre-commit-config.yaml

    • Add google-cloud-storage to the existing mypy hook's additional_dependencies so the module is available when tests follow the import chain into the scripts file
    • Add a dedicated mypy (scripts) hook scoped to ^scripts/python/idc_index_data_manager\.py$ with --explicit-package-bases, forcing consistent resolution as scripts.python.idc_index_data_manager in both direct and import-followed invocations
  • pyproject.toml

    • Add [[tool.mypy.overrides]] for scripts.python.idc_index_data_manager disabling attr-defined and import-untyped error codes — these are the errors triggered by deferred from google.cloud import storage imports where ruff's PLC0415 auto-fix rewrites the import form and defeats any inline # type: ignore suppression

- Add a separate mypy pre-commit hook entry for scripts/python/idc_index_data_manager.py
  using --explicit-package-bases to resolve consistent module naming
- Add google-cloud-storage to both mypy hooks' additional_dependencies
  so future google.cloud.storage imports are covered
- Add [[tool.mypy.overrides]] for scripts.python.idc_index_data_manager
  to disable attr-defined and import-untyped errors (handles the known
  ruff/mypy conflict for google.cloud.storage deferred imports)

Agent-Logs-Url: https://github.com/ImagingDataCommons/idc-index-data/sessions/e35c5d48-55ec-45fa-ae54-c20d15f4862f

Co-authored-by: fedorov <313942+fedorov@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix mypy checking for idc_index_data_manager.py fix: enable proper mypy checking for idc_index_data_manager.py May 8, 2026
Copilot AI requested a review from fedorov May 8, 2026 15:41
Copilot finished work on behalf of fedorov May 8, 2026 15:41
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.

fix: enable proper mypy checking for idc_index_data_manager.py

2 participants