[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-82165-en":3,"doc-seo-82165-105":29,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},82165,687197207057,"Sage","https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0",6,"Technology","Automating Just-In-Time Python Type Annotation Updating","Type annotations are increasingly used in Python to reduce errors from dynamic typing, yet they are frequently neglected when developers modify code, leading to outdated, inconsistent annotations. Such obsolete annotations can obstruct program comprehension, mislead developers, and even cause future bugs. This work proposes automating correction through Just-In-Time (JIT) type annotation updating. It introduces TypeUp, an LLM-based Type Annotation Updator that generates updated annotations from old annotations and code changes.","Automating Just-In-Time Python Type Annotation Updating  \nZhipeng Xue  \nThe State Key Laboratory of Blockchain and Data Security, Zhejiang University Hangzhou, China [zhipengxue@zju.edu.cn](zhipengxue@zju.edu.cn)  \nZhipeng Gao∗ Shanghai Institute for Advanced Study, Zhejiang University Shanghai, China [zhipeng.gao@zju.edu.cn](zhipeng.gao@zju.edu.cn)  \nXing Hu  \nThe State Key Laboratory of Blockchain and Data Security, Zhejiang University Hangzhou, China [xinghu@zju.edu.cn](xinghu@zju.edu.cn)  \nJingyuan Chen  \nCollege of Education, Zhejiang University Hangzhou, China [jingyuanchen@zju.edu.cn](jingyuanchen@zju.edu.cn)  \nXin Xia∗ The State Key Laboratory of Blockchain and Data Security, Zhejiang University Hangzhou, China [xin.xia@acm.org](xin.xia@acm.org)  \nShanping Li  \nThe State Key Laboratory of Blockchain and Data Security, Zhejiang University Hangzhou, China [shan@zju.edu.cn](shan@zju.edu.cn)  \narXiv :2607 .09054v 1 [ cs . SE] 10 Jul 2026  \nAbstract  \nType annotations are more and more popular in Python projects to avoid type errors caused by Python’s dynamic typing feature. However, when developers change source code, these type annotations are often neglected or overlooked, resulting in outdated and inconsistent type annotations. Such obsolete type annotations can hinder program comprehension, mislead developers, and even introduce bugs in the future. Therefore, it is necessary to avoid and correct these inconsistent type annotations from the very beginning. In this work, we argue that obsolete type annotations can be reduced and even avoided by automatically updating type annotations alongside code changes. We refer to this task as “Just-In-Time (JIT) type annotation updating”. To solve this task, we propose a novel LLM-based approach named TypeUp (Type Annotation Updator) to automate this task. TypeUp can automatically generate new type annotations based on the old type annotations and corresponding code changes. Specifically, TypeUp guides LLM to perform type annotation updates by eliciting its knowledge and logical reasoning power and learning from similar code changes. The evaluation results show that TypeUp outperforms the state-of-the-art type inference approach (i.e., TypeGen) by 41.9% on our task. Moreover, we conducted a practical application with real-world software projects, 20 out of 25 type annotation updates generated by our approach have already been confirmed by developers, showing our approach’s practical value in real-world environments.  \nCCS Concepts  \n• Software and its engineering → Software maintenance tools.  \n∗ Corresponding Authors  \nPermission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the owner/author(s) .  \nICSE ’26, April 12–18, 2026, Rio de Janeiro, Brazil © 2026 Copyright held by the owner/author(s) .  \nACM ISBN 979-8-4007-2025-3/26/04  \n[https://doi.org/10.1145/3744916.3764565](https://doi.org/10.1145/3744916.3764565)  \nKeywords  \nType Annotation, RAG, LLM-Agent, Type Annotation Update  \nACM Reference Format:  \nZhipeng Xue, Zhipeng Gao, Xing Hu, Jingyuan Chen, Xin Xia, and Shanping Li. 2026. Automating Just-In-Time Python Type Annotation Updating. In 2026 IEEE/ACM 48th International Conference on Software Engineering (ICSE’26), April 12–18, 2026, Rio de Janeiro, Brazil. ACM, New York, NY, USA, 12 pages. [https://doi.org/10.1145/3744916.3764565](https://doi.org/10.1145/3744916.3764565)  \n1 Introduction  \nPython has become increasingly popular among developers for its usage convenience and extensive third-party libraries. As a dynamically typed programming language, Python determines the type of a variable at runtime, rather than at compile time. In other words, developers ","cbCaianIxzQLAYQQ","https://ap.wps.com/l/cbCaianIxzQLAYQQ","pdf",2228757,1,12,"English","en",105,"# Introduction\n## Motivation for JIT Type Annotation Updating\n## Problem of Obsolete Type Annotations\n## Example of Inconsistent Annotations","[{\"question\":\"Why do outdated Python type annotations become a problem?\",\"answer\":\"When source code changes, developers often forget to update existing type annotations, making them inconsistent with the actual behavior. These obsolete annotations can hinder understanding and mislead developers, and may even contribute to future bugs.\"},{\"question\":\"What is Just-In-Time (JIT) type annotation updating?\",\"answer\":\"JIT type annotation updating refers to automatically updating type annotations alongside code changes so they remain consistent. The goal is to reduce or avoid obsolete annotations from the start.\"},{\"question\":\"How does the proposed TypeUp approach update type annotations?\",\"answer\":\"TypeUp is an LLM-based method that performs updates by leveraging the LLM’s knowledge and logical reasoning. It also learns from similar code changes to generate new type annotations based on old annotations and the corresponding modifications.\"}]",1784178544,30,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":27},"automating-just-in-time-python-type-annotation-updating","",{"@graph":35,"@context":85},[36,53,68],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/technology/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/automating-just-in-time-python-type-annotation-updating/82165/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-17","2026-07-16",true,{"@type":65,"interactionType":66,"userInteractionCount":20},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"Why do outdated Python type annotations become a problem?","Question",{"text":75,"@type":76},"When source code changes, developers often forget to update existing type annotations, making them inconsistent with the actual behavior. These obsolete annotations can hinder understanding and mislead developers, and may even contribute to future bugs.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"What is Just-In-Time (JIT) type annotation updating?",{"text":80,"@type":76},"JIT type annotation updating refers to automatically updating type annotations alongside code changes so they remain consistent. The goal is to reduce or avoid obsolete annotations from the start.",{"name":82,"@type":73,"acceptedAnswer":83},"How does the proposed TypeUp approach update type annotations?",{"text":84,"@type":76},"TypeUp is an LLM-based method that performs updates by leveraging the LLM’s knowledge and logical reasoning. It also learns from similar code changes to generate new type annotations based on old annotations and the corresponding modifications.","https://schema.org",{"og:url":51,"og:type":87,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":89,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,113,118,122,127,130,134],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":45,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":111,"slug":112},50,"technology",{"id":114,"doc_module":4,"doc_module_name":45,"category_name":115,"show_sort_weight":116,"slug":117},7,"Healthcare",40,"healthcare",{"id":119,"doc_module":4,"doc_module_name":45,"category_name":120,"show_sort_weight":28,"slug":121},8,"Research & Report","research-report",{"id":123,"doc_module":4,"doc_module_name":45,"category_name":124,"show_sort_weight":125,"slug":126},9,"Religion & Spirituality",20,"religion-spirituality",{"id":125,"doc_module":4,"doc_module_name":45,"category_name":128,"show_sort_weight":125,"slug":129},"World Cup","world-cup",{"id":131,"doc_module":4,"doc_module_name":45,"category_name":132,"show_sort_weight":131,"slug":133},10,"Lifestyle","lifestyle",{"id":135,"doc_module":4,"doc_module_name":45,"category_name":136,"show_sort_weight":106,"slug":137},19,"General","general"]