Skip to content

Phase 4 of Type Checking Cleanup/Refactor #157

@speediedan

Description

@speediedan

Remaining files to remove type checking errors from

src/interpretune/registry.py", # 15 errors - protocol compatibility, dict typing
src/interpretune/adapters/lightning.py", # 2 errors
src/interpretune/adapters/registration.py", # 1 error
src/interpretune/adapters/transformer_lens.py", # 6 errors
src/interpretune/adapters/sae_lens.py", # 4 errors
src/interpretune/adapters/circuit_tracer.py", # 23 errors
src/interpretune/analysis/core.py", # 78 errors - very complex type issues
src/interpretune/analysis/formatters.py", # 1 error
src/interpretune/analysis/ops/definitions.py", # 8 errors
src/interpretune/base/components/mixins.py", # 35 errors - optional member access, callable issues
src/interpretune/base/components/cli.py", # 24 errors - path operations, argument types
src/interpretune/base/components/core.py", # 1 error
src/interpretune/config/runner.py", # 10 errors
src/interpretune/config/shared.py", # 11 errors - type variable usage, tuple operations
src/interpretune/extensions/debug_generation.py", # 20 errors
src/interpretune/runners/analysis.py", # 28 errors - protocol mismatches, argument types
src/interpretune/runners/core.py", # 3 errors

Methodology validated:
✅ Start with files that already have < 5 errors to attempt to get them back to 0
✅ Continue reducing the overall type checking error count, applying pattern fixes we've identified in previous sub-issues and other patterns
✅ Fix simple typing issues with minimal changes
✅ Use explicit type annotations to resolve inference issues
✅ Add # type: ignore for deliberate patterns
✅ Expand configuration incrementally
✅ If type changes and assertions are not sufficient to address type checking errors, error on the side of being more aggressive with type checker directives rather than trying changes that could break tests and/or invalidate logic. If a true logical inconsistency is found, document it and use the appropriate type checking directive to silence the issue temporarily
✅ Favor assertions with appropriate messaging over raising RuntimeErrors or other exceptions.
✅ Update pyproject.toml incrementally with your progress in reducing error counts every commit, uncomment files with 0 errors that can newly be included in pyright checks
✅ Maintain 100% pass rate before adding new files and before committing

Gated by Phase 3 being completed
Incrementally expand type checking to recursively include all files in src directory with wildcard includes

Metadata

Metadata

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions