On November 15, 2026, according to github.com, a new tool named Gawain was released that enforces type annotations for variables, parameters, return values, and class attributes in Python code. Gawain then runs a type checker such as ty or pyrefly to verify that the declared types are correct, aiming to improve code readability and maintainability.

Enforcing Comprehensive Type Annotations Beyond Existing Tools

Traditional Python type checkers like mypy, Pyright, ty, and pyrefly infer types for variables without explicit annotations. Tools such as ruff's ANN rules and flake8-annotations only require type annotations on functions. In contrast, Gawain requires annotations on all variables and class attributes as well, eliminating ambiguous typing such as dict[str, Any], thereby increasing overall code rigor. This functionality was specifically developed by Gawain's creator to address this frustration.

Flexible Checker Options and Strict Mode Configuration

Gawain supports multiple type checkers, with ty as the default, and pyrefly available as an alternative. Users can switch checkers via configuration or command line. The tool relaxes annotation requirements for clear literals, constants, or constructor calls unless strict mode is enabled, which mandates annotations on every assignment. Gawain also supports warning suppression and can be integrated with pre-commit Git hooks for streamlined development workflows.

Practicality and Performance Validated on CPython 3.14 Standard Library

Internally, Gawain uses Astral's ruff_python_parser to parse Python code and either ty or Meta's pyrefly for type checking. It has been benchmarked on CPython 3.14's standard library, which includes 1,847 files and nearly one million lines of code, demonstrating its capability to handle large-scale codebases beyond personal projects.

Editor's take: Strict type annotations offer opportunities to improve code quality

By enforcing comprehensive type annotation requirements, Gawain advances the maturity of type safety within the Python ecosystem. For startups relying on Python for critical systems, adopting Gawain can help detect type errors earlier and improve code maintainability. Verifying its effectiveness involves integrating Gawain into existing projects and monitoring error reduction, along with measuring development and debugging time improvements using feedback from ty or pyrefly. If Gawain stabilizes integration with CI/CD pipelines, it could further reduce type-related defect risks and operational costs.