[chore]: cleanup! achieve full mypy type coverage / fix linting (finally)#161
Open
archae0pteryx wants to merge 29 commits intomainfrom
Open
[chore]: cleanup! achieve full mypy type coverage / fix linting (finally)#161archae0pteryx wants to merge 29 commits intomainfrom
archae0pteryx wants to merge 29 commits intomainfrom
Conversation
- Use uv run mypy instead of uvx to access installed packages - Add ignore_missing_imports for packages without stubs (matplotlib, pyarrow, etc.) - Add pandas-stubs to dev dependencies
- Add endpoint type annotation for DataEndpoint - Remove obsolete type: ignore comments - Fix ground_truth parameter type to match DataEndpoint signature
- Add endpoint type annotation for WorkerEndpoint - Fix return types on async methods (WorkerJob, not WorkerJob | SyncWorkerJob)
Remove Literal from BaseComponent.type to allow subclass narrowing
- Allow None for prediction parameter - Add type annotation for label variable - Inline Polygon patches to avoid type conflicts with Rectangle
- Fix unreachable code in jobs.py, worker_jobs.py, data_jobs.py - Fix callback types to use Coroutine for async callbacks - Fix variable reassignment type conflicts in data_top_k.py - Add null checks and type annotations in endpoint.py - Change return types from _RequestContextManager to ClientResponse
- Convert WorkerClientSession to Protocol for interface typing - Add null checks and type annotations in worker_endpoint.py - Fix return types to ClientResponse
- Fix var-annotated errors in predictions.py and annotations.py - Fix return types in data_endpoint.py (ClientResponse, StreamReader) - Fix callback types to use Coroutine for async callbacks - Add type annotations in request_tracer.py, periodic.py, metrics.py - Fix session return type in syncify.py - Fix Asset.annotations to handle None return from annotations parser - Remove duplicate JobState enum in metrics.py
Type coverage is now complete with 0 mypy errors
Remove exclude=["*"] to lint all Python files
- Remove unused `Enum` import from metrics.py - Remove unused `SyncWorkerJob` import from worker_endpoint.py - Rename `job` to `_job` in metrics.py loop (B007)
- Rename unused variable source_model_uuid to _source_model_uuid (F841) - Sort imports in data_endpoint.py (I001)
- Add D105 to ruff.toml ignore list (missing magic method docstrings) - Remove unused imports from endpoint.py (CallableABC, _RequestContextManager) - Sort imports in endpoint.py
- Fix list type annotations in assets.py using cast() for [None] * len() pattern - Add null check for client_session.close() in endpoint.py - Use lambdas instead of methods for open_stream in worker_jobs.py - Disable reportIncompatibleVariableOverride in pyrightconfig.json for Pydantic discriminated union pattern
…ated unions and pandas stubs
- Fix typo: sinc → since in assets.py comments - Remove duplicate pyright config from pyproject.toml (already in pyrightconfig.json) - Remove inline pyright ignore comments (covered by global config) - Remove commented-out exclude line from ruff.toml
Document Pydantic discriminated union inheritance anti-pattern for future refactoring
CI uses basedpyright which reads config from pyproject.toml. Remove separate pyrightconfig.json to have single source of truth.
31fc0db to
1ab7ae7
Compare
- Remove `type` field from BaseComponent to avoid inheritance type conflict - Each subclass now defines its own `type: Literal[...]` field independently - Remove unnecessary pyright suppressions (no longer needed) - Move pyright config to pyproject.toml for CI compatibility - Delete TODO.md since the issue is properly fixed
Only trigger checks workflow on: - Pushes directly to main branch - Pull requests targeting main branch This prevents duplicate runs when pushing to a PR branch.
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.
Summary
|| trueerror suppression from typecheck taskTODO.mdto track technical debtChanges
Type System Improvements
uv runfor access to installed package typesTypeVartorun_coro_thread_savefor proper return type inferenceWorkerClientSessiontoProtocolfor interface typingCode Quality
type: ignorecommentsCoroutinefor async callbacks_RequestContextManagertoClientResponseConfiguration
exclude = ["*"])Documentation
TODO.mddocumenting technical debt (Pydantic anti-pattern for future refactoring)Test plan
task typecheckpasses with 0 errorstask test- 112 tests passingtask lint:allpassesuvx pyright- 0 errors