Registry / serialization / microsoft-kiota-serialization-multipart

microsoft-kiota-serialization-multipart

JSON →
library1.12.0pypypi✓ verified 25d ago

This library provides core abstractions and implementation for serializing and deserializing multipart content within Microsoft Kiota generated Python clients. It's part of the broader Kiota ecosystem for building API clients and is currently at version 1.10.1, with a regular release cadence synchronized with other Kiota Python packages. It supports Python versions >=3.10 and <4.0.

pip install microsoft-kiota-serialization-multipart
INSTALL
IMPORT
SIG · MICROSOFT-KIOTA-SE
M
microsoft-kiota-serialization-multipart
serializationpythonv1.12.0
Install
2.1s avg
Import
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.12.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.000s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MultipartSerializationWriterFactory
from kiota_serialization_multipart import MultipartSerializationWriterFactory
from kiota_serialization_multipart import MultipartSerializationWriterFactory

This quickstart demonstrates how to initialize and register the `MultipartSerializationWriterFactory` and `MultipartParseNodeFactory` with Kiota's global registries. This registration is crucial for Kiota-generated API clients to automatically handle `multipart/form-data` content types for both sending requests and parsing responses. While direct usage of writers/parsers involves streams, this example focuses on their integration within the Kiota framework.

from microsoft_kiota_abstractions.serialization import ( register_default_deserializer, register_default_serializer, SerializationWriterFactoryRegistry, ParseNodeFactoryRegistry ) from microsoft_kiota_serialization_multipart import ( MultipartSerializationWriterFactory, MultipartParseNodeFactory ) # Initialize and register the multipart serialization and deserialization factories. # This makes them available to Kiota's internal machinery when # 'multipart/form-data' content type is encountered. mulipart_serializer_factory = MultipartSerializationWriterFactory() mulipart_parser_factory = MultipartParseNodeFactory() register_default_serializer(mulipart_serializer_factory) register_default_deserializer(mulipart_parser_factory) print("Microsoft Kiota Multipart Serialization and Deserialization factories registered.") # You can now retrieve them from the global registry (e.g., for custom HTTP client setups) # The Kiota generated clients typically handle this registration automatically. writer_factory = SerializationWriterFactoryRegistry.get_default_instance().get_serialization_writer_factory("multipart/form-data") parser_factory = ParseNodeFactoryRegistry.get_default_instance().get_parse_node_factory("multipart/form-data") if writer_factory and parser_factory: print("\nSuccessfully retrieved Multipart factories from the global registry:") print(f"- Serialization Writer Factory: {writer_factory}") print(f"- Parse Node Factory: {parser_factory}") print("\nThese factories enable Kiota clients to handle 'multipart/form-data' requests and responses.") else: print("\nError: Could not retrieve Multipart factories from the global registry.") # To perform actual serialization/deserialization, you would typically use a # Kiota-generated client or directly interact with the writer/parser with file streams # or form data.
Debug
Known issues
breakingVersion 1.10.0 and later dropped official support for Python 3.9. Users attempting to install or run with Python 3.9 will encounter `Requires-Python` metadata errors or unexpected runtime behavior.
fix
Upgrade your Python environment to 3.10 or newer. Alternatively, if Python 3.9 is required, pin the library version to `<1.10.0` (e.g., `microsoft-kiota-serialization-multipart<1.10.0`).
affects: >=1.10.0
gotchaThis package relies heavily on core interfaces defined in `microsoft-kiota-abstractions`. If you manually manage your dependencies, ensure `microsoft-kiota-abstractions` is explicitly installed alongside `microsoft-kiota-serialization-multipart` to avoid `ModuleNotFoundError` or `TypeError`.
fix
Verify that `microsoft-kiota-abstractions` is included in your project's `requirements.txt` or `pyproject.toml`. For `pip`, it's usually installed automatically as a transitive dependency.
affects: All versions
gotchaWhile `MultipartSerializationWriter` supports `write_object_value`, multipart content is fundamentally different from single-body formats like JSON or XML. It's designed for sending data as distinct parts (e.g., form fields, files). Direct serialization of a complex `Parsable` object might not produce the desired single-body multipart output as expected in other formats.
fix
When constructing multipart content, explicitly write each field or file as a separate part using specific methods like `write_str_value`, `write_bool_value`, or `write_byte_array_value` for file streams. Avoid relying solely on `write_object_value` for the entire payload unless you understand its specific implications for multipart content.
affects: All versions
Upgrade
Version history
1.12.0latest on PyPI · released Aug 27, 2026
Audit
Dependencies
microsoft-kiota-abstractionsrequiredProvides core interfaces and models required by all Kiota components, including serialization, such as `Parsable`, `SerializationWriter`, and `ParseNode`.
Agent activity
21 hits · last 30 days
node
20
Resources
microsoft-kiota-serialization-multipart — pip install microsoft-kiota-serialization-multipart · libregistry