fix(packaging): ship py.typed with the four broker distributions - #264
Merged
Conversation
mypy checks `keel_broker_api`, `keel_broker_coinbase`, `keel_broker_fake` and `keel_broker_robinhood` with `strict = true`, but none of them shipped a PEP 561 marker, so all four wheels through 0.7.0 carried their annotations invisibly. In this repo it never showed: mypy reads the source tree. Off it, a consumer gets `module is installed, but missing library stubs or py.typed marker` and falls back to `Any` for every symbol crossing the boundary -- the wheel still builds, still installs, still imports, and the type contract is simply gone. That is the same silent shape as an unpinned sibling, which is why this lands as a test and not a note. `keel_broker_api` is the one that costs most: the port's types are the contract every adapter and every consumer codes against. The test derives its subject list from the `[tool.mypy]` strict overrides rather than naming packages, so tightening a package into strict mode brings it under the rule automatically. It stays scoped to strict modules on purpose -- `keel.*` and `keel_core.*` are still `ignore_errors`, and a marker on unchecked code promises a guarantee nothing verifies. `keel_core` has one anyway, historically; the rule is a floor, not an equality, so that stays legal. Verified against a built wheel, not just the source tree: `unzip -l keel_broker_api-0.7.0-py3-none-any.whl` now lists `py.typed`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What
Adds an empty
py.typedtokeel_broker_api,keel_broker_coinbase,keel_broker_fakeandkeel_broker_robinhood, plus a packaging test that keeps them there.Why
All four are checked with
strict = true, but none shipped a PEP 561 marker — so every wheel through 0.7.0 carried its annotations invisibly.Inside this repo it never showed, because mypy reads the source tree. Off it, a consumer sees:
and falls back to
Anyfor every symbol crossing the boundary. The wheel still builds, still installs, still imports — the type contract is just gone. Same silent shape as an unpinned sibling, which is why this lands as a test rather than a note.keel_broker_apiis the one that costs most: the port's types are the contract every adapter and every consumer codes against.The test
test_strictly_typed_packages_ship_a_py_typed_markerderives its subject list from the[tool.mypy]strict overrides instead of naming packages, so tightening a package into strict mode brings it under the rule with no edit here.Scoped to strict modules deliberately —
keel.*andkeel_core.*are stillignore_errors, and a marker on unchecked code promises a guarantee nothing verifies.keel_corecarries one anyway for historical reasons; the rule is a floor, not an equality, so that stays legal.Verification
unzip -l keel_broker_api-0.7.0-py3-none-any.whlnow listskeel_broker_api/py.typed.ruff check keel tests packagesclean;mypyclean (224 files);pytest2721 passed, 1 skipped.🤖 Generated with Claude Code