Tool Open source

gawain

gawain is a Python type-annotation checker and linter written in Rust. It checks for annotations on variables, parameters, return values, and class attributes, including attributes assigned through self, then runs the ty or pyrefly type checker on the same files.

View repository Mentioned in 1 video ↓

Overview

Its default mode permits assignments whose types are obvious from literals, literal containers, or constructor calls; strict mode requires an annotation on every assignment. It reports rules such as missing annotations, untyped constants that should use Final, Any in annotations, and broken suppressions. It supports command-line and JSON output, pre-commit integration, checker selection, and annotation-only checks. The project is distributed under the MIT license.

What gawain is used for

1 use taken from transcripts — each links to the moment in the video.

  • A Python linter written in Rust that finds every missing type hint in your code, including on variables and class attributes, then runs ty or pyrefly over the result; the author clocks it at under half a second on the whole CPython standard library.

Videos mentioning gawain

1 in the library.