Repository navigation
ci: type-check a consumer of the built wheels with mypy --strict - #820
Open
Max Azatian (HardMax71) wants to merge 2 commits into
Open
Max Azatian (HardMax71) wants to merge 2 commits into
Max Azatian (HardMax71) wants to merge 2 commits into
Conversation
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.
10 of 11 tasks
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.
|
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? |
This branch has not been deployed
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.




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 runsmypy --strictontests/consumer/consumer.py. That file uses the public API of every package and pins representative return types withassert_type. It runs on the same Python matrix as the other jobs and feedscheck-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 intoAny. Against wheels built from 37492f7, where #722 started, it reports 15 errors, the issue'sRetryHandlerOption().get_key()example among them. On main it reports none.Testing Instructions
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.txtcd tests/consumer && mypy consumer.pypasses on Python 3.10, 3.12 and 3.13.kiota_bundle/py.typedfrom the installed package makes it fail withimport-untyped.