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
Question / Feature Request: First-class support for msgspec as an alternative to Pydantic #603
Currently, many asynchronous Python projects are moving away from Pydantic in favor of msgspec due to its superior performance in serialization and validation. While taskiq is flexible, the documentation and default examples heavily lean towards Pydantic.
I would like to clarify the current state of msgspec support and suggest making it a first-class citizen in the taskiq ecosystem.
Describe the solution you'd like
Compatibility: Are there any known architectural constraints that prevent using msgspec.Struct for task arguments and result schemas instead of Pydantic models?
Encoders: Is there a recommended way to implement a custom TaskiqEncoder using msgspec to ensure minimal overhead during task serialization?
Validation: Does the library plan to provide a built-in MsgspecBroker or similar integration to bypass Pydantic's validation logic entirely?
Describe alternatives you've considered
It would be great to have:
An official taskiq-msgspec package or a dedicated encoder implementation.
Documentation/examples showing how to define tasks using msgspec.Struct without triggering Pydantic-based validation under the hood.
Benchmarks or a "performance-first" guide for users who prioritize speed and low memory footprint.
Additional context
For high-load backend systems, reducing the serialization overhead is critical. msgspec is often 10-80x faster than Pydantic, and having it as a seamless alternative would make taskiq the go-to choice for performance-critical distributed tasks.
Well, I should just say that pydantic is used more of a type adapter rather than pure validation framework and it seems like now it's not that easy to migrate away from it. But I'd really like to, tbh, becuase pydantic seem to be qutie heavy as of for me.
Maybe we will consider doing so in upcoming releases, but as of for now, we'll stick to it. Thanks for you understanding.
Activity
s3rius commentedon Apr 10, 2026
Well, I should just say that pydantic is used more of a type adapter rather than pure validation framework and it seems like now it's not that easy to migrate away from it. But I'd really like to, tbh, becuase pydantic seem to be qutie heavy as of for me.
Maybe we will consider doing so in upcoming releases, but as of for now, we'll stick to it. Thanks for you understanding.