Skip to main content

4 posts tagged with "static-analysis"

static-analysis tag description

View All Tags

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.

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.

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

· 7 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 allows for rapid prototyping and flexibility, it can lead to undetected type errors in production as codebases grow. To combat this, PEP 484 introduced type hints.

However, type hints are advisory by default. To make them mandatory, you must use static type checkers (which scan code before execution) or runtime validators (which intercept code execution).

This guide details how Python handles type hints, compares the two major static type checkers (Mypy and Pyright), and explains how to enforce type constraints at runtime using Pydantic, Beartype, and Typeguard.

Paradigms Every Beginner Should Know Before Learning Shift Left

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

Before diving into Shift Left, which emphasizes catching bugs, performance, and security issues early in the software development lifecycle, it's important for new programmers to learn the foundational paradigms that support this philosophy.

These paradigms teach early thinking, good code hygiene, and automation - all of which are building blocks of effective software engineering.