Microsoft Kiota Abstractions

Core request, serialization, and auth abstractions that every Kiota-generated Python API client depends on to build and run.

Library
PyPI
v1.12.0
29stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
73/100Good
Development Activity96
Maintenance100
Community28
Maturity56
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture88
Code Quality82
Innovation74
Learning Curve70

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

  • RequestAdapter and RequestInformation abstractions for building and dispatching HTTP requests without binding a generated client to a specific transport library
  • Parsable, ParseNode, and SerializationWriter interfaces that decouple generated models from any one wire format (JSON, form, multipart, text)
  • A BackingStore protocol plus in-memory implementation for dirty-tracking model properties, enabling partial-update PATCH semantics
  • AuthenticationProvider and AccessTokenProvider interfaces, including an AllowedHostsValidator to prevent token leakage to untrusted hosts
  • BaseRequestBuilder and BaseRequestConfiguration base 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 RequestAdapter to point a generated SDK at a different HTTP stack (httpx, requests, aiohttp) than the official kiota-http package
  • Implementing a custom SerializationWriterFactory/ParseNodeFactory pair to support a wire format Kiota doesn’t ship out of the box
  • Writing a custom AuthenticationProvider to 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.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search