{"id":1550,"library":"microsoft-kiota-abstractions","title":"Microsoft Kiota Abstractions (Python)","description":"The `microsoft-kiota-abstractions` library provides core interfaces and base classes for Python SDKs generated by Microsoft Kiota. These abstractions define how HTTP requests are built, how data is serialized and deserialized, and the fundamental structure for models used in API clients. It is currently at version 1.10.1 and follows a frequent release cadence, often synchronized with other Kiota Python packages.","status":"active","version":"1.10.1","language":"en","source_language":"en","source_url":"https://github.com/microsoft/kiota-python","tags":["kiota","microsoft","api client","code generation","abstractions","sdk"],"install":[{"cmd":"pip install microsoft-kiota-abstractions","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"RequestInformation","correct":"from kiota_abstractions.request_information import RequestInformation"},{"symbol":"RequestAdapter","correct":"from kiota_abstractions.request_adapter import RequestAdapter"},{"symbol":"Parsable","correct":"from kiota_abstractions.serialization import Parsable"},{"symbol":"ParseNode","correct":"from kiota_abstractions.serialization import ParseNode"},{"symbol":"SerializationWriter","correct":"from kiota_abstractions.serialization import SerializationWriter"},{"symbol":"HttpMethod","correct":"from kiota_abstractions.http.method import HttpMethod"},{"symbol":"BaseRequestBuilder","correct":"from kiota_abstractions.base_request_builder import BaseRequestBuilder"}],"quickstart":{"code":"import datetime\nfrom typing import Dict, Optional\n\nfrom kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter\n\n\nclass MySimpleModel(Parsable):\n    \"\"\"Represents a simple data model implementing Parsable.\"\"\"\n\n    def __init__(self) -> None:\n        self._id: Optional[str] = None\n        self._name: Optional[str] = None\n        self._created_at: Optional[datetime.datetime] = None\n\n    @property\n    def id(self) -> Optional[str]:\n        return self._id\n\n    @id.setter\n    def id(self, value: Optional[str]) -> None:\n        self._id = value\n\n    @property\n    def name(self) -> Optional[str]:\n        return self._name\n\n    @name.setter\n    def name(self, value: Optional[str]) -> None:\n        self._name = value\n\n    @property\n    def created_at(self) -> Optional[datetime.datetime]:\n        return self._created_at\n\n    @created_at.setter\n    def created_at(self, value: Optional[datetime.datetime]) -> None:\n        self._created_at = value\n\n    def get_field_deserializers(self) -> Dict[str, callable]:\n        \"\"\"The deserialization information for the current model\"\"\"\n        return {\n            \"id\": lambda n: setattr(self, 'id', n.get_str_value()),\n            \"name\": lambda n: setattr(self, 'name', n.get_str_value()),\n            \"createdAt\": lambda n: setattr(self, 'created_at', n.get_datetime_value())\n        }\n\n    def serialize(self, writer: SerializationWriter) -> None:\n        \"\"\"Serializes information the current object\"\"\"\n        if not writer:\n            raise TypeError(\"writer cannot be None\")\n        writer.write_str_value(\"id\", self.id)\n        writer.write_str_value(\"name\", self.name)\n        writer.write_datetime_value(\"createdAt\", self.created_at)\n\n\n# Example usage (typically handled by Kiota-generated code)\nmodel = MySimpleModel()\nmodel.id = \"123\"\nmodel.name = \"Test Model\"\nmodel.created_at = datetime.datetime.now(datetime.timezone.utc)\n\nprint(f\"Model ID: {model.id}, Name: {model.name}, Created At: {model.created_at}\")","lang":"python","description":"This quickstart demonstrates how to implement the `Parsable` interface, a core abstraction for data models in Kiota. While typically Kiota generates these implementations, understanding `get_field_deserializers` and `serialize` is fundamental when working with or extending Kiota-generated SDKs. This example defines a simple model with string and datetime fields."},"warnings":[{"fix":"Upgrade your Python environment to version 3.10 or newer to use `microsoft-kiota-abstractions` v1.10.0 and later.","message":"Starting with version 1.10.0, support for Python 3.9 has been officially dropped. The library now requires Python 3.10 or higher.","severity":"breaking","affected_versions":">=1.10.0"},{"fix":"Ensure you install the full set of Kiota client libraries and use a Kiota-generated SDK for end-to-end API interaction. `microsoft-kiota-bundle` can simplify installation of common components.","message":"`microsoft-kiota-abstractions` alone does not provide a functional API client. It defines interfaces and base classes. To make actual API calls, you need additional Kiota packages like `microsoft-kiota-http` (for HTTP client implementations), `microsoft-kiota-serialization-json` (for JSON serialization), and an SDK generated by the Kiota tool.","severity":"gotcha","affected_versions":"All"},{"fix":"Focus on understanding the generated code and using the Kiota tool to create your SDKs. Consult Kiota documentation for best practices on customizing generated clients.","message":"Kiota is primarily a code generation tool. The `abstractions` library is consumed by the *generated* SDKs. Direct, manual implementation of interfaces like `Parsable` is usually only necessary when extending or customizing specific Kiota functionalities (e.g., custom serialization) rather than for general API client usage.","severity":"gotcha","affected_versions":"All"},{"fix":"Always verify that the keys in the dictionary returned by `get_field_deserializers` exactly match the API's property names, and the lambda functions correctly map to your model's attributes with appropriate type conversions (e.g., `get_str_value()`, `get_datetime_value()`).","message":"When implementing `Parsable`, pay close attention to the exact field names (case sensitivity) and types expected by the deserializers. Mismatches in `get_field_deserializers` can lead to runtime errors or incorrect data parsing.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}