Typify: A Lightweight Usage-driven Static Analyzer for Precise Python Type Inference
Ali Aman, Muhammad Asaduzzaman, and Shaowei Wang

TL;DR
Typify is a lightweight static analysis tool that infers precise Python types based on usage patterns, avoiding large datasets and deep learning, and effectively handling complex, real-world codebases.
Contribution
It introduces a novel, usage-driven static analysis approach combining symbolic execution and retrieval systems for accurate type inference without training data.
Findings
Typify matches or surpasses deep learning-based tools like Type4Py and HiTyper.
It outperforms industry-standard static type inference tools such as Pyre.
The approach is efficient and scalable for large, evolving Python projects.
Abstract
Python's dynamic type system, while offering significant flexibility and expressiveness, poses substantial challenges for static analysis and automated tooling, particularly in unannotated or partially annotated codebases. Existing type inference approaches often depend on existing type annotations or on deep learning models that require extensive training corpora and considerable computational resources, resulting in limited scalability and reduced interpretability. We introduce Typify, a lightweight, usage-driven static analysis engine designed to infer precise and contextually relevant type information without relying on statistical learning or large datasets. Typify integrates symbolic execution with iterative fixpoint analysis and a context-matching retrieval system to propagate and predict type information across entire projects. By constructing and traversing dependency graphs in…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
