Co-Evolution of Types and Dependencies: Towards Repository-Level Type Inference for Python Code
Python’s dynamic typing mechanism, while promoting flexibility, is a significant source of runtime type errors that plague large-scale software, which inspires the automatic type inference techniques. Existing type inference tools have achieved advances in type inference within isolated code snippets. However, repository-level type inference remains a significant challenge, primarily due to the complex inter-procedural dependencies that are difficult to model and resolve. To fill this gap, we present PyTIR, a novel approach based on LLMs that achieves repository-level type inference through the co-evolution of types and dependencies. PyTIR constructs an Entity Dependency Graph (EDG) to model the objects and type dependencies across the repository. During the inference process, it iteratively refines types and dependencies in EDG for accurate type inference. Our key innovations are: (1) an EDG model designed to capture repository-level type dependencies; (2) an iterative type inference approach where types and dependencies co-evolve in each iteration; and (3) a type-checker-in-the-loop strategy that validates and corrects inferences on-the-fly, thereby reducing error propagation. When evaluated on 12 complex Python repositories,PyTIR significantly outperformed prior works, achieving a \textit{TypeSim} score of 0.89 and a \textit{TypeExact} score of 0.84, representing a 27% and 40% relative improvement over the strongest baseline. More importantly, PyTIR removed new type errors introduced by the tool by 92.7%. This demonstrates a significant leap towards automated, reliable type annotation for real-world Python development.
Tue 7 JulDisplayed time zone: Eastern Time (US & Canada) change
11:00 - 12:30 | DependencyJournal-First Paper / Industry Papers / Research Papers / Tool Demonstrations at MB 9B Chair(s): Na Meng Virginia Tech | ||
11:00 20mTalk | How Can ChatGPT Support Human Security Testers to Help Mitigate Supply Chain Attacks? Journal-First Paper Ying Zhang Wake Forest University, Wenjia Song Virginia Tech, Zhengjie Ji Virginia Tech, Daphne Yao Virginia Tech, Na Meng Virginia Tech Link to publication Pre-print | ||
11:20 20mTalk | Dependency-Aware Over-the-Air Framework for Reliable Software Defined Vehicle Updates Industry Papers Juyeon Park Hyundai Motor Company; Korea Advanced Institute of Science and Technology (KAIST), In-Young Ko Korea Advanced Institute of Science and Technology | ||
11:40 20mTalk | Dependency-Guided Repository-Level C-to-Rust Translation with Reinforcement Alignment Industry Papers jiafeng Harbin Institute of Technology, Shenzhen, Wenjie Gan Southeast university of China, Cuiyun Gao Harbin Institute of Technology, Shenzhen, Chaozheng Wang The Chinese University of Hong Kong, Feng Luo Harbin Institute of Technology (Shenzhen), Xin Xia Zhejiang University, Ge Li Peking University, Kui Liu Huawei | ||
12:00 20mTalk | Co-Evolution of Types and Dependencies: Towards Repository-Level Type Inference for Python Code Research Papers Shuo Sun Institute of Software, Chinese Academy of Sciences, Shixin Zhang Institute of Software, Chinese Academy of Sciences, Jiwei Yan Institute of Software at Chinese Academy of Sciences, Jun Yan Institute of Software, Chinese Academy of Sciences, Jian Zhang Institute of Software at Chinese Academy of Sciences; University of Chinese Academy of Sciences | ||
12:20 10mTalk | DependaFix: A GitHub App for Fixing Breaking Dependency Updates in CI Build for Java Projects Tool Demonstrations Enock Mecheo New York University Abu Dhabi, May Mahmoud New York University Abu Dhabi, Sarah Nadi New York University Abu Dhabi | ||