Skip to main content

GRPC in Python Example

· 7 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

gRPC in Python: A Practical Example and When to Choose It​

gRPC (gRPC Remote Procedure Calls) is a modern, high-performance, open-source framework developed by Google that enables communication between services. It relies on Protocol Buffers (protobuf) for its Interface Definition Language (IDL) and uses HTTP/2 for transport.

It has become the standard choice for communication in microservices and polyglot (multi-language) environments where performance, efficiency, and strong typing are critical.

GRPC on AWS: API Gateway Support, Lambda Integration, Streaming, and ALB Alternatives

· 10 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

The question of whether AWS API Gateway supports gRPC is crucial for architects planning microservices deployments on AWS. The answer, which has evolved, is a nuanced Yes, but primarily through the HTTP API and only for unary calls, while traditional gRPC streaming requires alternative AWS services.

Custom Classes for Python Exceptions: Extending the Error Toolkit

· 7 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Custom Classes for Python Exceptions: Extending the Error Toolkit​

Defining custom exception classes is a hallmark of professional-grade Python code. Instead of relying on generic built-in exceptions (like ValueError or TypeError) for every application-specific failure, custom exceptions provide clear, unambiguous signals about why an operation failed.

This article details the necessity, structure, and best practices for creating and utilizing your own exception hierarchy.

Python Exception Handling: Complete Guide to try-except, Propagation, Hierarchy, and Tracebacks

· 12 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Writing robust, fault-tolerant software in Python requires a solid understanding of how errors propagate, how Python's built-in exceptions are structured, and how to capture context-rich debugging information when failures occur.

This guide provides a comprehensive manual on exception handling in Python, detailing block flow control (try, except, else, finally), stack unwinding dynamics, the class inheritance hierarchy, multi-exception catch patterns, custom error design, context managers, and production logging strategies for tracebacks.

Linking Logs Across Python Microservices(Distributed Tracing)

· 7 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Distributed Tracing: Linking Logs Across Python Microservices​

In modern microservices architectures, a single user request might flow through an API Gateway, an authentication service, a business logic service, and several data services. While structured logging makes each service's log output clean, it doesn't automatically connect the dots.

Distributed Tracing is the operational practice of adding unique identifiers to every log and header related to a single request, allowing you to reconstruct the entire request path across all services.

Python Logging: The Complete Guide from basicConfig to Structured JSON Observability

· 11 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Logs are a primary source of truth for application health, performance audits, and runtime debugging. However, outputting unstructured plain text console strings limits searchability and scalability. To build modern, observable applications, you need a robust logging hierarchy, log rotation schemes, centralized configurations, and structured output formats.

This guide provides a comprehensive manual on Python logging, covering basic setup parameters, log rotation, dict-based configurations, JSON-structured output, contextual metadata injection, and performance best practices.

MyPy vs. Pyright: A Comprehensive Guide to Python Static Type Checkers

· 6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

To maintain clean and bug-free codebases in large Python projects, static type checking is essential. The two primary static type checkers in the modern Python ecosystem are MyPy (the reference implementation) and Pyright (a fast, TypeScript-based checker developed by Microsoft).

While both tools parse type hints to identify errors before runtime, they differ in their implementation languages, performance profiles, library extensibility, and strictness. This guide provides a detailed comparison of MyPy and Pyright, analyzing their architectural trade-offs, behavioral differences, and how to combine them into a single workflow.

Dataclass AttributeError Solutions

· 9 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

The AttributeError is one of the most common exceptions in Python, indicating an attempt to access or set a class attribute that simply doesn't exist. When it occurs within the context of a @dataclass, it often points to a misunderstanding of how the decorator automatically generates methods like __init__ and __setattr__.

Here is a breakdown of the most frequent AttributeError scenarios involving dataclasses and the high-level solutions to resolve them.

Benchmarking Dataclasses, Named Tuples, and Pydantic Models: Choosing the Right Python Data Structure

· 7 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

When structuring immutable, simple data in Python, developers often choose between several tools. While Dataclasses and Pydantic models dominate modern usage, older structures like namedtuple and simpler tools like tuple and dict still have niche uses.

This article compares these common data structures based on their primary function, mutability, and performance characteristics to help you choose the best tool for the job.

MyPy Configuration for Strict Typing

· 7 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

MyPy is the premier static type checker for Python. While running MyPy with no configuration works, achieving true, robust type safety requires a configuration that enables strict mode and specifically targets potential weak points in Python's type system.

This article details the essential settings within the mypy.ini, pyproject.toml, or setup.cfg file that an experienced developer uses to maximize type checking effectiveness.

Looking for more content?
Hrekov Blog contains 165 articles. Browse the blog archive or Explore the full timeline.