Microsoft Kiota Abstractions
Core request, serialization, and auth abstractions that every Kiota-generated Python API client depends on to build and run.
Repository Health
Technical Analysis
Microsoft Kiota Abstractions is the foundation package underneath every Python SDK produced by Kiota, Microsoft’s OpenAPI-driven client generator. Rather than shipping HTTP calls or JSON parsing itself, it defines the abstract contracts — RequestAdapter, Parsable, SerializationWriter, ParseNode, BackingStore — that a generated SDK’s request builders are written against, and which concrete implementation packages (kiota-http, kiota-serialization-json, kiota-authentication-azure) plug into at runtime.
This separation is what lets a single generated client swap its HTTP transport, its wire format (JSON, form, text, multipart), or its authentication provider without regenerating a line of code. It’s the same pattern used across Kiota’s other language targets (.NET, Go, Java, TypeScript, Ruby), and in Python it underpins production SDKs including the Microsoft Graph Python client.
What You Get
RequestAdapterandRequestInformationabstractions for building and dispatching HTTP requests without binding a generated client to a specific transport libraryParsable,ParseNode, andSerializationWriterinterfaces that decouple generated models from any one wire format (JSON, form, multipart, text)- A
BackingStoreprotocol plus in-memory implementation for dirty-tracking model properties, enabling partial-update PATCH semantics AuthenticationProviderandAccessTokenProviderinterfaces, including anAllowedHostsValidatorto prevent token leakage to untrusted hostsBaseRequestBuilderandBaseRequestConfigurationbase classes that every generated request-builder class in a Kiota SDK inherits from- OpenTelemetry-instrumented tracing hooks baked into the request pipeline for observability in generated clients
Common Use Cases
- Providing the runtime dependency for a Kiota-generated Python SDK (e.g. an OpenAPI-described internal API or the Microsoft Graph client)
- Implementing a custom
RequestAdapterto point a generated SDK at a different HTTP stack (httpx, requests, aiohttp) than the official kiota-http package - Implementing a custom
SerializationWriterFactory/ParseNodeFactorypair to support a wire format Kiota doesn’t ship out of the box - Writing a custom
AuthenticationProviderto integrate a generated client with an in-house or non-Azure token source - Enabling backing-store change tracking on generated models so only modified fields are sent on update requests
Under The Hood
Architecture
The package is organized as a set of ABC-based interface modules — request_adapter.py, serialization/, store/, authentication/ — with almost no concrete logic of its own; the one meaningful default implementation is InMemoryBackingStore in store/in_memory_backing_store.py. BaseRequestBuilder (base_request_builder.py) is the class every generated request-builder inherits from, taking a RequestAdapter and URL template in its constructor and delegating all actual HTTP work to whatever adapter is injected — the classic dependency-inversion pattern that lets kiota-http, or any custom adapter, be swapped in without touching generated code. Because generated SDKs import only from this package’s public surface, changing a core abstraction here is a breaking change across every Kiota-generated Python client in the ecosystem, which explains the conservative, interface-first design.
Tech Stack
Pure Python 3.10+ with from __future__ import annotations throughout for forward-compatible type hints, packaged via flit_core as declared in pyproject.toml. Runtime dependencies are deliberately minimal: std-uritemplate for RFC 6570 URL templating and opentelemetry-api/opentelemetry-sdk for built-in request tracing. It sits in a five-package monorepo (packages/abstractions, authentication, bundle, http, serialization) managed together under one projects-config.json and released independently per package via release-please.
Code Quality
The tests/ directory mirrors the source layout (authentication/, store/, top-level modules) and uses pytest with pytest-asyncio for the library’s async request-handling paths; a conftest.py supplies shared fixtures and mock model classes. Type checking runs via mypy with warn_unused_configs, formatting via yapf (PEP8-based) and isort, and linting via pylint, all wired into a GitHub Actions build.yml workflow plus a separate CodeQL security-analysis workflow. Errors surface as explicit TypeError/ValueError raises in constructors (e.g. BaseRequestBuilder rejecting a null request_adapter) rather than being swallowed.
What Makes It Unique
Unlike most HTTP client abstractions, this package’s interfaces are the actual compilation target of a code generator — every method signature here is a contract the Kiota generator itself must produce matching calls against across seven language ecosystems, not just Python. The BackingStore protocol is the more distinctive piece: it gives generated models automatic dirty-tracking so a PATCH request can include only changed properties, without hand-written diffing logic in any generated class.