type: clean mypy in optracing, quant, serve, session, sysinfo, telemetry, utils and enforce in CI#916
Open
xieofxie wants to merge 5 commits into
Open
type: clean mypy in optracing, quant, serve, session, sysinfo, telemetry, utils and enforce in CI#916xieofxie wants to merge 5 commits into
xieofxie wants to merge 5 commits into
Conversation
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
Brings seven more
winml.modelkitpackages to zero mypy errors under the strict[tool.mypy]config and wires them into the required CI type-check gate (16 → 23 packages). Continues the incremental cleanup from #896.Cleaned: optracing, quant, serve, session, sysinfo, telemetry, utils (sysinfo was already clean). Fixes follow the repos typing playbook — fix at the source first;
cast()only at genuine untyped third-party boundaries;Anyonly for true dynamic pass-throughs.Real bugs surfaced (not just typing)
utils/hub_utils.pyversion import —from ..version import __version__referenced a non-existent module; guarded bytry/except, so the export version was silently always"unknown". Fixed tofrom .. import __version__. (The containing helperinject_hub_metadatais dead code — tracked in Clean up unused inject_hub_metadata in utils/hub_utils.py #913.)utils/hub_utils.py—model_info.modelId→model_info.id(huggingface_hub renamed the attribute).Notable fixes
resolved_ep is Noneand single-modemodel_path; widened PDH counter containers tofloat; class-level_initializedannotation; distinct ctypes struct locals.LoggerProvider/Loggerinstance attributes (were inferred asNone, cascading into unreachable/attr-defined); OTel/JSON boundary casts; typed the@contextmanager/@asynccontextmanagergenerators.cast()atjson.loads/app.stateboundaries;import binasciito usebinascii.Error(typeshed doesnt exposebase64.binascii); explicit single-modemodel_pathguard.# type: ignores;DataclassInstancecast for generic-TypeVardataclass reflection;EPAliaskey cast for the alias lookup; loop-variable rename to fixInputTensorSpec/OutputTensorSpecshadowing.Config changes (
pyproject.toml)qairt.*→ignore_missing_imports(external Qualcomm AI Runtime SDK; imported only insidecompile_qairt_bin.py, which runs in a separatevenv-winmlsubprocess — absent from the CI env).windowsml→follow_untyped_imports = true(installed but ships nopy.typed; analyzing its source is clean and keeps its inline annotations instead of collapsing toAny).Verification
Success: no issues found in 300 source files.@