You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Complete library typing and enforce mypy strict in CI #722
Agreed with Vincent Biret (@baywet) on 2026-10-05: small PRs, one at a time, no source-breaking changes. Each PR only adds or tightens annotations, and public names stay importable as they are today (__all__ lists every name a module exports now, so from x import * keeps working). When a package reaches zero errors, its [tool.mypy] gets strict = true, so CI keeps it there.
Baseline: mypy --strict reports 297 errors on main (37492f7, 1.14.2) with mypy 2.3.1. 95 of them are missing explicit exports in four __init__.py files. The numbers in brackets below are the errors left after the first item.
Small packages to zero, with strict = true in their [tool.mypy]: kiota_authentication_azure (3), kiota_bundle (2), kiota_serialization_multipart (1), kiota_serialization_form (1), kiota_serialization_text (2), kiota_serialization_json (4)
kiota_abstractions.store (22)
kiota_abstractions: request_information, request_adapter, api_client_builder and the small modules (30)
kiota_abstractions.serialization proxy factories (9), then strict = true for kiota_abstractions
kiota_http.middleware.options (25)
kiota_http.middleware: retry handler and pipeline (35)
kiota_http.middleware: the other handlers (32)
kiota_http.httpx_request_adapter (32) and the rest of kiota_http (4), then strict = true for kiota_http
A CI check that builds the wheels, installs them and runs mypy --strict on a small consumer file using the public API
PR links are added here as each one opens.
Original request
Hi! I use LLMs to help write code, and passing strict type checks such as mypy --strict is one of my guardrails. A project I'm working on depends on this library, so more complete type information would save me a lot of troubleshooting and help catch mistakes earlier.
Is your feature request related to a problem? Please describe.
The library already has substantial type annotations and runs mypy in CI. However, strict checking still exposes gaps that affect consumers. On the checkout described below, ordinary mypy passes, while mypy --strict reports 298 errors across the eight library packages.
For example, checking this consumer code with mypy --strict example.py reports implicit-export errors for both imports, an untyped call to get_key(), and an Any return:
I also built the microsoft-kiota-bundle wheel locally and confirmed that it lacks py.typed. Mypy treats an installed import of kiota_bundle.default_request_adapter as untyped, despite the annotations in its source.
Describe the solution you'd like
Complete the existing typing support and enforce strict mypy checks for the library packages.
Suggested definition of done:
All eight library source packages pass mypy --strict in CI with a pinned mypy version across the supported Python versions.
Consumer checks against installed wheels verify public imports and representative inferred return types; all intended typed packages ship py.typed.
Public types remain useful, with any necessary suppressions narrowly scoped and explained, rather than broadly replacing types with Any or disabling checks.
Existing runtime tests pass and public behavior remains compatible.
I suggest keeping unit-test typing and adopting another checker outside the initial scope. Recurring generated-code annotation changes could be tracked separately with the generator work they require.
Describe alternatives you've considered
Local stubs or per-project mypy overrides could work around individual problems, but would leave consumers maintaining those workarounds. Completing the shared library annotations would benefit dependent projects directly.
Additional context
Checkout: eef36d7e72197063f234b24407edad15ad873bea; local packages report version 1.12.1.
Environment: Linux, Python 3.13.5, mypy 2.3.1; dependencies installed using uv, with all eight packages installed in editable mode.
The library-only baseline is 298 errors in 101 checked source files. The generated validation client adds 345 errors in 86 files; those are separate from the library count.
The largest recurring library categories are missing explicit exports, incomplete function annotations, untyped calls, and missing generic arguments.
Plan and status
Agreed with Vincent Biret (@baywet) on 2026-10-05: small PRs, one at a time, no source-breaking changes. Each PR only adds or tightens annotations, and public names stay importable as they are today (
__all__lists every name a module exports now, sofrom x import *keeps working). When a package reaches zero errors, its[tool.mypy]getsstrict = true, so CI keeps it there.Baseline:
mypy --strictreports 297 errors on main (37492f7, 1.14.2) with mypy 2.3.1. 95 of them are missing explicit exports in four__init__.pyfiles. The numbers in brackets below are the errors left after the first item.kiota_abstractions.serialization,kiota_abstractions.store,kiota_http.middlewareandkiota_http.middleware.options, and addpy.typedtokiota_bundle(297 -> 202, no runtime change) (fix: declare public exports for strict type checkers and ship py.typed in bundle #764)strict = truein their[tool.mypy]:kiota_authentication_azure(3),kiota_bundle(2),kiota_serialization_multipart(1),kiota_serialization_form(1),kiota_serialization_text(2),kiota_serialization_json(4)kiota_abstractions.store(22)kiota_abstractions:request_information,request_adapter,api_client_builderand the small modules (30)kiota_abstractions.serializationproxy factories (9), thenstrict = trueforkiota_abstractionskiota_http.middleware.options(25)kiota_http.middleware: retry handler and pipeline (35)kiota_http.middleware: the other handlers (32)kiota_http.httpx_request_adapter(32) and the rest ofkiota_http(4), thenstrict = trueforkiota_httpmypy --stricton a small consumer file using the public APIPR links are added here as each one opens.
Original request
Hi! I use LLMs to help write code, and passing strict type checks such as
mypy --strictis one of my guardrails. A project I'm working on depends on this library, so more complete type information would save me a lot of troubleshooting and help catch mistakes earlier.Is your feature request related to a problem? Please describe.
The library already has substantial type annotations and runs mypy in CI. However, strict checking still exposes gaps that affect consumers. On the checkout described below, ordinary mypy passes, while
mypy --strictreports 298 errors across the eight library packages.For example, checking this consumer code with
mypy --strict example.pyreports implicit-export errors for both imports, an untyped call toget_key(), and anAnyreturn:I also built the
microsoft-kiota-bundlewheel locally and confirmed that it lackspy.typed. Mypy treats an installed import ofkiota_bundle.default_request_adapteras untyped, despite the annotations in its source.Describe the solution you'd like
Complete the existing typing support and enforce strict mypy checks for the library packages.
Suggested definition of done:
mypy --strictin CI with a pinned mypy version across the supported Python versions.py.typed.Anyor disabling checks.I suggest keeping unit-test typing and adopting another checker outside the initial scope. Recurring generated-code annotation changes could be tracked separately with the generator work they require.
Describe alternatives you've considered
Local stubs or per-project mypy overrides could work around individual problems, but would leave consumers maintaining those workarounds. Completing the shared library annotations would benefit dependent projects directly.
Additional context
eef36d7e72197063f234b24407edad15ad873bea; local packages report version 1.12.1.Would you be open to using strict mypy compliance as a tracked enhancement for the library packages?