Repository navigation
fix: declare public exports for strict type checkers and ship py.typed in bundle - #764
Conversation
…d in bundle Add __all__ to the kiota_abstractions.serialization, kiota_abstractions.store, kiota_http.middleware and kiota_http.middleware.options packages, matching kiota_abstractions.authentication, and add the missing py.typed marker to kiota_bundle. Part of microsoft#722.
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: None
What changed in this PR
Adds explicit public exports for strict type checkers by defining __all__ in key package __init__.py files, aligning behavior with mypy --strict expectations while keeping normal imports unchanged.
Changes:
- Define
__all__inkiota_http.middlewareandkiota_http.middleware.optionsto formalize re-exported symbols. - Define
__all__inkiota_abstractions.serializationandkiota_abstractions.storeto make re-exports visible to strict type checkers.
| File | Description |
|---|---|
| packages/http/httpx/kiota_http/middleware/options/__init__.py | Adds __all__ for re-exported middleware option classes. |
| packages/http/httpx/kiota_http/middleware/__init__.py | Adds __all__ for re-exported middleware handlers/types/constants. |
| packages/abstractions/kiota_abstractions/store/__init__.py | Adds __all__ for store/backing-store public API symbols. |
| packages/abstractions/kiota_abstractions/serialization/__init__.py | Adds __all__ for serialization public API symbols. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.



Overview
First item of the checklist in #722. Under
mypy --strict, a name imported into a package's__init__.pywithout being listed in__all__doesn't count as exported, sofrom kiota_abstractions.serialization import Parsableis an error for strict consumers.This adds
__all__to the four__init__.pyfiles that re-export names, the same waykiota_abstractions.authenticationalready does:kiota_abstractions.serializationkiota_abstractions.storekiota_http.middlewarekiota_http.middleware.optionsIt also adds the missing
py.typedmarker tokiota_bundle, so type checkers use the annotations of the installed package.Related Issue
Part of #722, which stays open for the remaining items.
Notes
There is no change for normal imports. Every class and constant stays importable, also through
from ... import *. The only names*no longer pulls in are the submodule names (parsable,retry_handler, ...). Those landed in the package namespace only as a side effect of the relative imports, andkiota_abstractions.authenticationalready behaves this way.With mypy 2.3.1,
mypy --strictacross the eight library packages goes from 297 to 202 errors. The defaultmypyrun used in CI still passes for every package.Testing Instructions
packages/abstractions:mypy --strict -p kiota_abstractionsreports 86 errors on main and 61 on this branch. Frompackages/http/httpx,kiota_httpgoes from 163 to 128.yapf -dr,pylint --disable=Wandpytestpass for abstractions, http and bundle, andisort --check-onlypasses on the changed files.uv build --wheelinpackages/bundlenow produces a wheel that containskiota_bundle/py.typed.