Complete Type Checking for All Python Files: Enable pyright for all src/interpretune + src/it_examples (70 files, 0 errors)#160
Conversation
|
NOTE This new PR that should target #157 should not suffer from that configuration issue so ensure that you do not commit any changes unless you have successfully run the full test suite and see no issues (100% passing)
pip install -r requirements/ci/requirements.txt
pip install --upgrade -r requirements/post_upgrades.txt
cd /home/runner/work/interpretune/interpretune && python -m pytest src/interpretune tests -v --import-mode=importlibOtherwise, follow the checklist outlined in the target issue: |
Co-authored-by: speediedan <7462936+speediedan@users.noreply.github.com>
…lved Co-authored-by: speediedan <7462936+speediedan@users.noreply.github.com>
I've successfully resolved the dependency and import issues and got the test suite running. The main issue was a compatibility problem with the I'm now ready to proceed with the type checking cleanup work for issue #157. I'll follow the checklist:
Let me now focus on the type checking fixes as outlined in the issue. |
…achieving 0 errors with stricter type checking Co-authored-by: speediedan <7462936+speediedan@users.noreply.github.com>
I've successfully completed removing all custom pyright directives and transitioned to stricter type checking settings. The codebase now achieves 0 errors across all 62 configured files with default pyright strictness. Key accomplishments:
The fixes were minimal and surgical - only needed import path updates and specific type ignores for legitimate patterns (datasets Column/IterableColumn compatibility). Used the proven approach from previous phases with targeted The codebase is now ready for production with default pyright strictness across all configured files, completing the systematic type checking cleanup initiative. Commit: 78a6c7a |
|
@copilot Similar to our approach to eliminating type errors in the |
…ixes Co-authored-by: speediedan <7462936+speediedan@users.noreply.github.com>
…tal with 0 errors Co-authored-by: speediedan <7462936+speediedan@users.noreply.github.com>
I've successfully enabled type checking for all Python files within Results:
Technical approach:
Files added to type checking: Note on Jupyter notebooks: The Total configuration: 70 files with 0 type errors (up from 62 files) Commits: d748380 |
|
@copilot, you're getting close. I've made some updates to our type stub generation to facilitate static analysis of main module imports. There remain 4 errors in rte_boolq.py. Follow the same proven approach and checklist used in your previous sessions and commits to enable type checking for that file and validate running pyright for the entire src/it_examples tree (minus the excludes we have) is error free. |
|
@copilot , you're getting close. I've made some updates to our type stub generation to facilitate static analysis of main module imports. There remain 4 errors in rte_boolq.py. Follow the same proven approach and checklist used in your previous sessions and commits to enable type checking for that file and validate running pyright for the entire src/it_examples tree (minus the excludes we have) is error free. |
…hecking Co-authored-by: speediedan <7462936+speediedan@users.noreply.github.com>
Fixed the remaining 4 type errors in rte_boolq.py using the proven approach from previous sessions. The entire src/it_examples tree now has 0 type errors. Applied minimal surgical changes with targeted |
…ct.yaml type checking configuration to use wildcards
There was a problem hiding this comment.
Pull Request Overview
This PR completes a comprehensive type checking initiative by extending pyright configuration to cover all Python files in both src/interpretune and src/it_examples, achieving 0 errors across 70 configured files. The primary goal is to establish production-ready type safety standards across the entire interpretune framework.
Key Changes
- Extended scope: Type checking expanded from 62 files (src/interpretune only) to 70 files (both src/interpretune + src/it_examples)
- Comprehensive fixes: Applied minimal surgical type annotations and targeted
# type: ignoredirectives with descriptive comments across all source files - Simplified configuration: Replaced complex file-by-file include list with simple directory-based approach (
"src/") while maintaining necessary exclusions
Reviewed Changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/core/test_hub_manager.py | Updated import path for huggingface_hub cache scanning functionality |
| src/it_examples/patching/dep_patch_shim.py | Added lambda wrapper for condition tuple in dependency patch |
| src/it_examples/patching/_patch_utils.py | Enhanced type annotation for optional string parameter |
| src/it_examples/notebooks/saelens_adapter_example/sl_utils/sl_mem_utils.py | Added union type annotation for optional filter device parameter |
| src/it_examples/notebooks/example_op_collections/op_collection_demo_utils.py | Fixed return type annotation and added type ignore for dynamic import |
| src/it_examples/notebooks/example_op_collections/hub_op_collection/hub_op_definitions.py | Corrected return type and added type ignore for tensor/dict union handling |
| src/it_examples/experiments/rte_boolq.py | Added comprehensive type checking bypass directives for complex demonstration code |
| Multiple src/interpretune files | Applied systematic type annotations and targeted ignore directives for mixin patterns, protocol compatibility, and dynamic attributes |
| pyproject.toml | Simplified pyright configuration from complex file list to directory-based inclusion |
| requirements/ci/requirements.txt | Updated dependency versions from pip-compile regeneration |
| scripts/generate_op_stubs.py | Enhanced stub generation with improved docstring formatting and parameter defaults |
| Various configuration files | Updated paths, test commands, and build configurations for consistency |
This PR completes the comprehensive type checking initiative by extending pyright configuration to cover all Python files in both
src/interpretuneandsrc/it_examples, achieving 0 errors across 70 configured files with default strictness settings.Scope Expansion
Original scope:
src/interpretunetree only (62 files)Final scope: Both
src/interpretune+src/it_examplestrees (70 files total)Changes Made
Extended type checking to all 13 Python files in
src/it_examples:12 files fixed with minimal surgical changes using proven patterns:
str | Nonefor optional parameterslambda:wrappers for condition tuples# type: ignore[attr-defined]for complex import hooks1 complex example file (
rte_boolq.py) uses targeted type ignore directives for maintainability in demonstration contextTechnical approach mirrors proven methodology:
Final Fixes Applied
Fixed 4 remaining type errors in
rte_boolq.py:cust_task_promptoverride with targeted# type: ignore[assignment]for intentional demo override# type: ignore[assignment]forDefaultAnalysisBatchProtocol→AnalysisBatchassignments (3 operations)Validation Results
The codebase now provides complete type checking coverage for all Python source files, establishing production-ready type safety standards across the entire interpretune framework and examples.
Addresses #157.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.