Home / Companies / Speakeasy / Blog / Post Details
Content Deep Dive

Cleaner async Python SDKs with constructor-based approach

Blog post from Speakeasy

Post Details
Company
Date Published
Author
David Adler
Word Count
436
Company Posts That Month
5
Language
English
Hacker News Points
-
Post removed?
No
Summary

Python SDK generation now supports a constructor-based approach to handle synchronous and asynchronous operations, providing a cleaner interface by eliminating method name duplication and confusion, which was caused by the previous method-based system with _async suffixes. This new approach differentiates between synchronous and asynchronous clients through separate constructors, making async usage an explicit choice and improving IDE suggestions by avoiding duplicate method names. Users configure this behavior in the `gen.yaml` file, with the `asyncMode` setting offering a 'split' value to enable the constructor-based approach, although this represents a breaking change for existing SDK users who will need to update their code. The change aligns with Python’s async ecosystem, which uses an event loop for non-blocking I/O operations, and matches patterns used in established Python libraries, offering a more intuitive interface for developers familiar with async conventions.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.