Skip to main content

3 posts tagged with "typing"

typing tag description

View All Tags

MyPy Configuration for Strict Typing

· 7 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

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.

Python Enum Integration with Typing

· 6 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

The combination of the standard enum.Enum class and the typing module is a powerful best practice in modern Python. By using an Enum class as a type hint, you signal to static type checkers (like MyPy, Pyright) and fellow developers that only specific, named constants are valid inputs or outputs, enforcing both type safety and value safety.