fix: enable proper mypy checking for idc_index_data_manager.py#144
Draft
Copilot wants to merge 2 commits into
Draft
fix: enable proper mypy checking for idc_index_data_manager.py#144Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
- 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
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.
scripts/python/idc_index_data_manager.pywas invisible to mypy because the pre-commit hook'sfilespattern only matchedsrc|tests. A single combined pattern caused a "source file found twice" error — mypy resolves the file asidc_index_data_managerwhen passed directly, but asscripts.python.idc_index_data_managerwhen followed via test imports.Changes
.pre-commit-config.yamlgoogle-cloud-storageto the existing mypy hook'sadditional_dependenciesso the module is available when tests follow the import chain into the scripts filemypy (scripts)hook scoped to^scripts/python/idc_index_data_manager\.py$with--explicit-package-bases, forcing consistent resolution asscripts.python.idc_index_data_managerin both direct and import-followed invocationspyproject.toml[[tool.mypy.overrides]]forscripts.python.idc_index_data_managerdisablingattr-definedandimport-untypederror codes — these are the errors triggered by deferredfrom google.cloud import storageimports where ruff's PLC0415 auto-fix rewrites the import form and defeats any inline# type: ignoresuppression