Skip to main content

90 posts tagged with "python"

python tag description

View All Tags

Flake8 or ruff - Detects Unused Variables, Bad Patterns, and Syntax Errors Early

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

Writing clean and correct code is critical for every Python programmer, especially beginners. Tools like flake8 and ruff help catch issues like unused variables, potential bugs, syntax errors, and styling problems early - often before you even run the code.

Black - Auto-Format Your Python Code Like a Pro

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

Writing clean and consistent code is a mark of professionalism, and it also makes collaboration easier. But keeping formatting consistent manually is hard. That's where Black, the Python code formatter, shines.

Black automatically formats your code according to PEP 8 (Python's style guide), with minimal configuration and zero fuss. This guide will show you how to install it, use it, and why it's helpful - especially if you're new to Python programming.

Python Type Hinting: Static Checkers (Mypy, Pyright), Error Suppression, and Runtime Enforcement

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

Python is dynamically typed by default. While this enables rapid prototyping, it can lead to undetected type errors in production as codebases scale. To address this, PEP 484 introduced type hints.

However, type hints are purely advisory at runtime. To make them effective, developers combine static type checkers (Mypy, Pyright), strategic error suppression for legacy/dynamic code, and runtime validators (Pydantic, Beartype, Typeguard) for external data boundaries.

This guide provides a comprehensive manual on Python type checking, comparing Mypy and Pyright, detailing granular error suppression techniques, and enforcing runtime contracts.

What is Shift Left Paradigm in Programming? Explained for Beginners

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

In modern software engineering, the phrase "shift left" has transitioned from DevOps terminology to a core development philosophy. Rather than representing a tool or a command-line utility, shifting left is an architectural mindset.

Whether you are writing Python or building complex distributed services, understanding this approach will help you build reliable systems, discover bugs earlier, and shorten deployment cycles.

This guide explains the Shift Left model, demonstrates how to apply it in Python projects, and explores other development paradigms that complement it.

How to Stream Media Files from S3 Directly to AWS Lambda Using FFmpeg in Python

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

Processing media files inside AWS Lambda can be a challenge due to its resource limits, lack of a local disk, and timeouts. However, it's entirely possible to stream files directly from S3 into FFmpeg, process them on the fly, and avoid writing anything to disk.

In this guide, we'll cover:

  • Streaming files from S3 into Lambda
  • Using ffmpeg with stdin and stdout in memory
  • Avoiding /tmp bottlenecks
  • Examples and production-ready patterns

Best Practices for Using msgspec in Python for High-Performance Serialization

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

msgspec is a high-performance serialization library designed for modern Python applications. It combines type-safe data modeling, blazing-fast parsing, and flexible support for multiple serialization formats, including MessagePack, JSON, and TOML.

This article outlines the best practices for integrating msgspec into your codebase. It provides a practical, performance-oriented guide to writing cleaner, safer, and faster Python services.

What is an Off-by-One Error in Python? (Explained for Kids!)

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

Have you ever counted your toys and accidentally said you had 11, but really only had 10? That's kind of what an off-by-one error is in Python!

It's a tiny mistake where your program counts 1 too many or 1 too few. These mistakes are super common, even for professional programmers.

Python Data Serialization: Alternatives to Pydantic and the Modern Ecosystem

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

In high-throughput backend services and microservices, data serialization is frequently the primary CPU bottleneck. Converting incoming HTTP payloads or MessagePack buffers into validated Python objects-and marshaling domain entities back into JSON-can consume a significant portion of request processing time.

While Pydantic remains the dominant choice across the Python ecosystem, my experience building backend APIs and data pipelines has led me to evaluate alternative frameworks when hitting latency and memory constraints.

This article provides an engineering analysis of Python data serialization frameworks, evaluating their underlying compilation engines, memory characteristics, developer ergonomics, and suitability for performance-critical systems.

Best Practices for Using Pydantic with Flask for Request and Response Serialization

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

Pydantic is widely known for its powerful data validation and parsing capabilities using Python type hints. While it's most popular with FastAPI, it can be elegantly integrated with Flask to improve request validation, input parsing, and response formatting.

This article outlines best practices for combining Flask with Pydantic in a clean, maintainable way.