A Python tool that automatically generates type annotations by monitoring runtime execution, with low overhead and tensor shape inference.
RightTyper is a Python tool that automatically generates type annotations by monitoring a program's execution at runtime. It records the types of function arguments, return values, local variables, and class fields with low overhead, helping developers add static type checking to unannotated or partially annotated codebases.
Python developers working on codebases without complete type annotations, especially those using libraries like NumPy, JAX, or PyTorch who need tensor shape annotations and want to integrate type checking into their test suites.
RightTyper offers significantly lower runtime overhead compared to similar tools, seamless integration with pytest, and advanced features like tensor shape inference and type pattern recognition, making it the most efficient solution for gradual type annotation adoption.
A fast and efficient type assistant for Python, including tensor shape inference
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Adds only ~25% overhead on Python 3.12+, far less than tools like MonkeyType which can slow execution by 41x, as shown in benchmarks from the README.
Detects type patterns and introduces type variables instead of naive unions, yielding more precise generic annotations that help static checkers catch errors.
Generates jaxtyping-compatible shape annotations for NumPy, JAX, and PyTorch tensors, a unique feature for machine learning projects highlighted in the features.
Works directly with pytest and automatically excludes test-specific types like mocks, making it easy to integrate into existing test workflows without manual filtering.
Requires Python 3.12+ to run, limiting adoption in projects using older versions, even though it can output annotations for older Python via the --python-version flag.
Types are inferred only from executed code, so untested or rare code paths may remain unannotated or incorrectly typed, reducing coverage without comprehensive tests.
With numerous flags for sampling, container handling, and output control, the tool can be overwhelming for simple use cases, requiring careful tuning to avoid suboptimal results.