Skip to main content

How to Easily Write Docstrings in Python Without a Headache (Using VSCode)

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

Writing docstrings in Python can feel like a chore - especially with the odd formatting involving triple quotes, >>> signs, and parameter blocks. But clear, standardized docstrings are critical for both readability and maintainability.

If you're using VSCode (Visual Studio Code), you're in luck. With a few extensions and configurations, you can make writing professional, PEP 257-compliant docstrings painless.

What is Behaviour Driven Developement in Python

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

We're constantly striving for higher quality, faster delivery, and closer collaboration. In the realm of API development, where contracts and interactions are paramount, these goals often feel like a constant uphill battle. This is where Behavior-Driven Development (BDD) emerges not just as a testing methodology, but as a powerful paradigm for designing, developing, and validating robust Python API systems.

What is Design-First paradigm in Python

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

We've all seen projects spiral when API design is an afterthought. It's a common trap: dive straight into coding, then realize downstream that your API is clunky, inconsistent, and a nightmare to integrate with. This is precisely why the Design-First (API-First) paradigm isn't just a buzzword; it's a critical methodology for building scalable, maintainable, and truly collaborative API systems, especially within the Python ecosystem.

Test-Driven Development (TDD) - Writing Code That's Correct by Design

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

Not only Shift-Left mantra matters​

The mantra of "Shift Left" has echoed through the halls of software development for years now, and for good reason. The core idea is simple yet powerful: move testing, quality, and security considerations as early as possible in the development lifecycle. It's about catching problems when they're small and cheap to fix, not when they're gargantuan headaches in production. But as a lead engineer who's seen a few projects through the trenches, I've come to realize that "Shift Left" isn't the destination; it's the starting point.

To truly build robust, maintainable, and high-quality software, especially in a dynamic language like Python, we need to embrace a set of development paradigms that not only support but enhance the "Shift Left" philosophy. These aren't just buzzwords; they are methodologies that, when adopted, fundamentally change how we approach writing code for the better.

Testing in Python for Beginners. Using `unittest` and `pytest` with Fun Examples

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

Writing tests in Python helps ensure that your code works correctly. In this guide, we'll use two popular testing tools: the built-in unittest module and the third-party library pytest. We'll walk through both using examples related to vegetables and AI model names.

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.

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