Skip to content

ci: type-check a consumer of the built wheels with mypy --strict - #820

Merged
Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
HardMax71:ci/strict-typing-consumer-check
Oct 21, 2026
Merged

Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
HardMax71:ci/strict-typing-consumer-check

Conversation

@HardMax71

Copy link
Copy Markdown
Contributor

Overview

Last item in #722. A new CI job builds the eight wheels with python -m build, as the release pipeline does, installs them and runs mypy --strict on tests/consumer/consumer.py. That file uses the public API of every package and pins representative return types with assert_type. It runs on the same Python matrix as the other jobs and feeds check-python-version-matrix.

Related Issue

Closes #722.

Demo

Not needed for this change.

Notes

The job checks the installed wheels, not the source tree, so it sees what a consumer sees: a missing py.typed, a name left out of __all__, or a return type that turns into Any. Against wheels built from 37492f7, where #722 started, it reports 15 errors, the issue's RetryHandlerOption().get_key() example among them. On main it reports none.

Testing Instructions

  • Build and install the wheels in a fresh environment: for p in abstractions authentication/azure http/httpx serialization/form serialization/json serialization/text serialization/multipart bundle; do python -m build --wheel --outdir dist "packages/$p"; done; pip install dist/*.whl -r tests/consumer/requirements-dev.txt
  • cd tests/consumer && mypy consumer.py passes on Python 3.10, 3.12 and 3.13.
  • Deleting kiota_bundle/py.typed from the installed package makes it fail with import-untyped.

A new job builds the eight wheels with python -m build, as the release pipeline does, installs them and runs mypy --strict on tests/consumer/consumer.py. That file uses the public API of every package and pins representative return types with assert_type, so the job fails when a package loses py.typed, an export or a return type. Against wheels built from 37492f7, where microsoft#722 started, it reports 15 errors.
@HardMax71
Max Azatian (HardMax71) requested a review from a team as a code owner October 20, 2026 20:08
Copilot AI balanced review requested due to automatic review settings October 20, 2026 20:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread .github/workflows/build.yml Fixed
Comment thread .github/workflows/build.yml Fixed
Comment thread .github/workflows/build.yml Fixed
Comment thread .github/workflows/build.yml Fixed
pip install --only-binary :all: for both installs in type-check-installed-wheels, so no dependency runs a setup script. Every dependency has a wheel on Python 3.10 to 3.15.
Copilot AI balanced review requested due to automatic review settings October 20, 2026 20:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sonarqubecloud

sonarqubecloud Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Comment thread .github/workflows/build.yml Dismissed
Comment thread .github/workflows/build.yml Dismissed
@HardMax71

Copy link
Copy Markdown
Contributor Author

Vincent Biret (@baywet) the two remaining Sonar findings (locked versions) are the same rule that is open on main for the existing build and validation jobs (build.yml L51 and L91). Could you mark them as safe, or should this job pin with hashes?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The wheel-based checks, consumer assertions, and CI integration have no identified blocking issues.

No open issues 🎉

Review effort: Balanced

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@github-project-automation github-project-automation Bot moved this to In Progress 🚧 in Kiota Oct 21, 2026
@baywet
Vincent Biret (baywet) merged commit 5a4fdf6 into microsoft:main Oct 21, 2026
69 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress 🚧 to Done ✔️ in Kiota Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

Complete library typing and enforce mypy strict in CI

4 participants