Introduce CI type-checking harness. - #952
Merged
Merged
Conversation
- Add a `type-check` job to `.github/workflows/autotest.yml` targeting Python 3.10 to 3.14 on Windows. - Build `comtypes` as an sdist and install it into an isolated `.venv` under `type-check/` to test against the installed package. - Add `type-check/tests/test_packaging.py` to ensure `comtypes` is loaded from `site-packages` rather than the local workspace source. - Update `.github/workflows/autofmt.yml` to format and lint `type-check/.` with ruff.
…g tests - Extend `type-check` CI job matrix with type checkers (`ty`, `mypy`, `pyright`). - Add `type-check/pyproject.toml` configuring type-checking tools and their dependencies. - Add `type-check/tests/test_scrrun.py` to verify type inference and assertions on generated COM classes (`Scripting.Dictionary`) via `client.GetModule`.
- Add `type-check/tests/test_uia.py` to verify runtime types and static type inference for generated `IUIAutomation` and `IUIAutomationElement` classes. - Ensure standard COM interfaces reject call and subscript operations both at runtime and during static type checking.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #952 +/- ##
=======================================
Coverage 88.98% 88.98%
=======================================
Files 140 140
Lines 13678 13678
=======================================
Hits 12171 12171
Misses 1507 1507 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Building on the background and motivation outlined in #951, this PR introduces a standalone static type-checking harness into the CI pipeline as an initial step.
With a view toward expanding type documentation and guides in the future, the primary goal here is to establish a minimal CI test harness that verifies the consistency between runtime behavior and static type definitions generated via
client.GetModule.Motivation & Scope
client.GetModuleTypes:Ensure that generated COM wrapper classes and interfaces generated by
client.GetModuleare accurately inferred by type checkers against the actual runtime implementations.Set up an isolated
type-check/environment and dedicated CI workflow to pave the way for future documentation, examples, and test expansion without polluting the main test suite.In line with the phased transition plan, runtime compatibility with Python 3.9 is preserved, while static type-checking jobs run on Python 3.10+ to satisfy modern type-checker requirements.