Skip to content
Tech News
← Back to articles

New linter Gawain forces type hints on every Python variable, not just functions

read original more articles
GoKawiil Brief

A developer released Gawain, an open-source tool that checks Python code for missing type annotations on variables, function parameters, return values, and class attributes, not just functions as existing tools like ruff's ANN rules do. After confirming all annotations are present, Gawain hands the code off to a type checker, either ty or pyrefly, to verify the declared types are actually correct. Example output shows Gawain flagging unannotated variables and class attributes before running the deeper type check.

Why It Matters

GoKawiil's interpretation of the reporting above, not reported fact.

Existing Python type-checking tools such as mypy, Pyright, ty, and pyrefly can infer types automatically, so Gawain's stricter approach targets developers who want explicit annotations enforced rather than inferred, which the creator says improves code clarity by discouraging vague types like dict[str, Any]. This could appeal to teams enforcing strict coding standards, though it adds an extra layer of friction compared to tools that already infer types silently.

Key Takeaways

Source: github.com, 2026-11-15

Published there as: “Show HN: Gawain – Require type hints on all Python variables”

Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.
Keep reading
python 68 briefs →