Home / Companies / Speakeasy / Blog / August 2024

August 2024 Summaries

6 posts from Speakeasy

Filter
Month: Year:
Post Summaries Back to Blog
Python's dynamic typing allows developers to quickly prototype without worrying about type definitions, but this flexibility can lead to runtime errors that are difficult to debug. Type annotations, introduced in Python 3.5, help catch type-related errors during development, while data classes and TypedDicts introduced in later versions allow for structured data representation with minimal boilerplate. Pydantic, a comprehensive data validation library, enhances Python's type safety by enforcing type hints at runtime, offering data validation, parsing, serialization, and deserialization, making it ideal for SDK development. Pydantic's use of Rust ensures minimal performance overhead, and its ability to handle complex data validation tasks makes it a preferred choice for projects needing robust type safety, as exemplified by its adoption at Speakeasy. By integrating Pydantic, developers can achieve a balance between flexibility and type safety, ensuring data integrity while maintaining Python's ease of use.
Aug 29, 2024 3,306 words in the original blog post.
A recent update to TypeScript SDKs has introduced enhancements that make them more efficient for browser applications, emphasizing lean, ergonomic, and type-safe designs without requiring breaking changes. By introducing Standalone Functions, the SDKs become tree-shakable, allowing developers to import only necessary functions, significantly reducing bundle sizes and improving application performance, as demonstrated by a 75% reduction in bundle size in a benchmark test. Additionally, users can now generate SDKs on GitHub directly from the terminal using the --github flag, simplifying workflows with the help of the Speakeasy CLI. The update also includes new features and bug fixes across various languages, improving functionality such as streaming uploads and error handling in languages like Python, Go, and C#.
Aug 28, 2024 441 words in the original blog post.
The blog post explores the evolution of Python HTTP clients, highlighting the transition from Python's built-in urllib module to popular third-party libraries like Requests, HTTPX, and AIOHTTP. Requests, released in 2011, became the go-to choice for its user-friendly design, but its synchronous nature limited its use in modern asynchronous programming environments. AIOHTTP, introduced in 2014, embraced Python's asyncio framework, allowing for efficient handling of concurrent connections, making it ideal for high-performance applications. HTTPX, launched in 2019, bridges the gap by offering both synchronous and asynchronous capabilities similar to Requests, while also supporting HTTP/2 and type annotations. The post discusses each library's strengths, weaknesses, and ideal use cases, with HTTPX emerging as a versatile choice for developers needing flexibility between synchronous and asynchronous operations. The post also explains how Speakeasy uses HTTPX in its SDKs to provide a seamless experience for both operation modes, and illustrates the ease of switching between HTTP clients through examples.
Aug 24, 2024 3,197 words in the original blog post.
Speakeasy has introduced Standalone Functions for its TypeScript SDKs, allowing developers to create more efficient applications by selectively importing only the functions they need, rather than entire libraries. This approach facilitates leaner app development, especially in performance-sensitive environments like browsers, by leveraging tree-shaking and code minification to exclude unused functionality. Standalone Functions also improve error handling by returning a Result<Value, KnownErrors> type and do not replace the existing class-based interface, offering developers flexibility based on project requirements. By combining standalone functions with ES Modules, substantial bundle size reductions are achieved, enhancing performance metrics such as JavaScript parsing time. This new structure contrasts with traditional SDKs, which often include unnecessary code, thus increasing the total bundle size. Speakeasy's shift towards shallower abstractions aims to optimize modern web app development and maximize the potential of tree-shaking, offering developers a more controlled and efficient way to incorporate SDK functionalities.
Aug 16, 2024 1,162 words in the original blog post.
The early access release of a new Test Generation feature has been announced, designed to help developer teams confidently ship SDKs by ensuring they function correctly for end users. The feature supports TypeScript, Python, and Go, generating tests based on examples from OpenAPI specifications and allowing for custom requests and responses. Tests are created in a new directory using popular testing frameworks like Vitest for TypeScript, Pytest for Python, and Testify for Go. The update also includes new features and bug fixes for various languages and tools, such as enhanced Readme rendering with environment variables, a Python debug logger, and improved handling of streaming responses and TypedDict unmarshalling in Python. Additionally, there are fixes and updates for Terraform, Java, and C#, with enhancements related to security environment variables, dependencies, and support for specific OpenAPI patterns and enums.
Aug 07, 2024 322 words in the original blog post.
Designing efficient and user-friendly API responses is crucial for a positive user experience, as highlighted in the guide to using the OpenAPI specification for API development. This approach emphasizes the importance of considering user needs from the start by writing the OpenAPI specification before coding, which helps define properties for schemas and responses, maintaining a focus on usability. Key principles include being explicit in data descriptions, maintaining consistency in naming conventions, and understanding when to use nested structures. For successful API responses, it's important to provide users with the resources they request and ensure responses are structured for clarity and performance, such as paginating large data sets. Error responses should inform users about what went wrong and how to recover, with the reuse of standard error descriptions to maintain consistency. The guide also discusses more advanced techniques for combining or selecting schemas using operators like allOf, anyOf, and oneOf in response definitions, and highlights the use of default properties for unspecified responses. Ultimately, the design-first approach using OpenAPI not only aids in creating well-defined and efficient responses but also supports the development of a robust API ecosystem.
Aug 06, 2024 2,309 words in the original blog post.