Repository navigation
fix(bindings): ship the PEP 561 marker so type checkers read the Python package - #586
Merged
Merged
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
…on package
The package is annotated throughout but shipped no `py.typed`, so mypy
skipped it as untyped ("missing library stubs or py.typed marker") and
every value it returned was `Any` in the application.
Add the empty marker, list it in the setuptools package data (which
otherwise carries only the native libraries), add the `Typing :: Typed`
classifier, and make build-wheel.sh refuse a wheel without it.
marioolf
force-pushed
the
fix/python-py-typed
branch
from
October 19, 2026 20:30
f28c4da to
09b5f4c
Compare
bahdotsh
approved these changes
Oct 20, 2026
bahdotsh
left a comment
Member
There was a problem hiding this comment.
Thank you so much for raising the PR!
LGTM!
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
The Python package is annotated throughout, but it shipped no PEP 561
py.typedmarker. So mypy treatsoffline_protocol_sdkas untyped: every import fails withimport-untyped, and every value the SDK returns isAnyin the application.This PR:
bindings/python/offline_protocol_sdk/py.typed;[tool.setuptools.package-data], which otherwise carries only the native libraries, so setuptools would leave the marker out of the wheel;Typing :: Typedclassifier;scripts/build-wheel.shrequires in the wheel, so the release build fails if it ever goes missing.Before and after
A consumer script against the installed wheel:
Without the marker (the current release):
With the marker:
Related issues
None.
Type of change
fix: bug fixChecklist
CHANGELOG.mdupdated (Unreleased, Fixed)Breaking changes
None. An application already running mypy on code that uses the SDK will start getting real type errors where it used to get
Any. That is the intended effect, and mypy does not report errors inside an installed package's own source.Notes for reviewers
How I verified it:
uv build --wheeland checked it containsoffline_protocol_sdk/py.typedand carriesClassifier: Typing :: Typedin its metadata.build-wheel.shuses against that wheel and against a copy with the marker removed: the first passes, the second reports['offline_protocol_sdk/py.typed']missing.bash -npasses on the script.build-wheel.shend to end, since it needs the native library built for each platform. CI's wheel job runs it.