Repository navigation
Ship the py.typed marker the Typing :: Typed classifier promises - #241
Open
sunilmehta-si wants to merge 1 commit into
Open
sunilmehta-si wants to merge 1 commit into
sunilmehta-si wants to merge 1 commit into
Conversation
4 tasks done
|
Hey @sunilmehta-si, checked this end to end rather than by reading:
The test in |
Author
|
Thanks for checking it end to end. You're right that the test only looks at the source tree; the wheel is the real check. The PR body's Verification section covers it: the rebuilt wheel contains |
pyproject.toml has declared "Typing :: Typed" since the first release, but
no py.typed marker was ever added, and hatch only ships what is in the tree.
Without the marker mypy skips the package ("module is installed, but missing
library stubs or py.typed marker") and types every xai_sdk import as Any,
which is exactly what users who trust the classifier run into.
Adds the empty marker, a test that the installed package carries it, and a
changelog entry.
sunilmehta-si
force-pushed
the
ship-py-typed
branch
from
October 30, 2026 16:24
795d8c0 to
b20372e
Compare
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
pyproject.tomlhas declaredTyping :: Typedsince the first release, but the package has never shipped apy.typedmarker (find src -name py.typedis empty, and the builtxai_sdk-1.21.0-py3-none-any.whlhas none in its RECORD). Type checkers only use a package's inline annotations when that marker is present, so mypy users get:for
client.chat.create(...). pyright happens to infer from source by default, which is why this is easy to miss.This adds the empty
src/xai_sdk/py.typed(hatch'spackages = ["src/xai_sdk"]already includes non-Python files, so no build change), a test that the installed package carries the marker, and a CHANGELOG entry under Unreleased.Verification
py.typedis in it.client.chat.create(...)andreveal_types the result: before, the error above andAny; after,Success: no issues foundandRevealed type is "xai_sdk.sync.chat.Chat".ruff format --check,ruff checkand the new test pass with the locked environment (uv sync --locked).Marked as a minor change per the PR template, so no issue was opened first; happy to open one if you prefer.