arrow
Return

MigrateLib: A tool for end-to-end Python library migration

delete2026-11-03
delete0
PRE
AI
M
Mohayeminul Islam *
A
Ajay Kumar Jha
M
May Mahmoud
Sarah Nadi cover
Sarah Nadi (Sarah Nadi)
DOI:10.1007/s10664-026-10970-9delete
deleteOriginal
deleteShare
deleteSave
Abstract

Abstract

En 中文
Library migration is the process of replacing a library with a similar one in a software project. Manual library migration is time-consuming and error-prone, as it requires developers to understand the Application Programming Interfaces (API) of both libraries, map equivalent APIs, and perform the necessary code transformations. This paper presents an LLM-based end-to-end solution that can automatically migrate code between any arbitrary pair of Python libraries that provide similar functionality. Before building the technique, we first systematically study the capabilities of LLMs for library migration on PyMigBench, an existing benchmark of 314 real-world library migrations. We find that the best performing LLM, GPT-4o, can correctly perform 57% of the migrations. We also identify post-processing steps that can further improve the performance. Based on this, we develop MigrateLib, a command-line application that combines the power of LLMs, static analysis, and dynamic analysis to provide accurate library migration. We evaluate MigrateLib on 717 migration scenarios in 175 real-world Python applications that are not from PyMigBench. We find that MigrateLib can migrate 32% of the migrations with complete correctness without any developer intervention. We inspect a sample of the incomplete migrations to understand how many of the required changes have already been done by MigrateLib and how many manual changes are still needed to complete the migration. We find that for more than half of the inspected migrations, MigrateLib completed 73% of the required migration-related changes, leaving only 27% of the required changes for manual intervention.
Keywords:
Library migration
Python
Large Language Models
A review on Python libraries for temporal network analysis
err2026-06-01
err0
errOAAI
errClaudio D.G. Linhares; Jean R. Ponciano; Martim R. Oliveira; Amilcar Soares; Agma J.M. Traina; Andreas Kerren
errShare
errSave
EEGraph: An open-source Python library for modeling electroencephalograms using graphs
err2023-01-01
err4
errOAAI
errMaitin, Ana M.; Nogales, Alberto; Chazarra, Pedro; Jose Garcia-Tejedor, Alvaro
errShare
errSave
PyThermLIA: A Python library to implement digital lock-in processing
err2025-10-01
err0
errOAAI
errVargas, E.; Bedoya, A.; Borges, A.; Calderon, A.; Delgado, O.; Marin, E.
errShare
errSave
Pygrossone: a python-powered library for operating with the infinity computer arithmetic
err2025-06-03
err0
PREAI
errAlberto Falcone; Alfredo Garro; Yaroslav D. Sergeyev
errShare
errSave
TextX: A Python tool for Domain-Specific Languages implementation
err2017-01-01
err48
PREAI
errDejanovic, I.; Vaderna, R.; Milosavljevic, G.; Vukovic, Z.
errShare
errSave
Robust End-to-End Spoken Language Understanding in Low-Resource Settings
err2026-02-03
err0
errOAAI
errAndrés Piñeiro-Martín; Carmen García-Mateo; Laura Docío-Fernández; María del Carmen López-Pérez
errShare
errSave
QIDLearningLib: A Python library for quasi-identifier recognition and evaluation
err2025-08-21
err0
errOAAI
errSancho Amaral Simões; João P. Vilela; Miriam Seoane Santos; Pedro Henriques Abreu
errShare
errSave

Journal

Empirical Software Engineering cover
Empirical Software Engineering
IF:
3.6
Papers:
2.0K
Citations:
6.4K

Organization

N
north dakota state university
Scholars:
340
Papers: 148
Citations: 152
U
University of Alberta
Scholars:
2.9K
Papers: 1.2K
Citations: 3.2W
N
New York University Abu Dhabi
Scholars:
388
Papers: 188
Citations: 1.3K
researcher View more organizations
Cited Papers

Cited Papers

Hybrid API Migration: A Marriage of Small API Mapping Models and Large Language Models
err2023-08-04
err0
PREAI
errZhou,Bingzhe; Wang,Xinying; Xu,Shengbin; Yao,Yuan; Pan,Minxue; Xu,Feng; Ma,Xiaoxing
errShare
errSave
BLEU
err2001-01-01
err0
errOAAI
errKishore Papineni; Salim Roukos; Todd Ward; Wei-Jing Zhu
errShare
errSave
err
IF0
err
err0
errOAAI
err
errShare
errSave
Learning to recommend third-party library migration opportunities at the API level
err2020-05-01
err32
errOAAI
errAlrubaye, Hussein; Mkaouer, Mohamed Wiem; Khokhlov, Igor; Reznik, Leon; Ouni, Ali; Mcgoff, Jason
errShare
errSave
Software Testing With Large Language Models: Survey, Landscape, and Vision
err2024-04-01
err31
errOAAI
errWang, Junjie; Huang, Yuchao; Chen, Chunyang; Liu, Zhe; Wang, Song; Wang, Qing
errShare
errSave
researcher View more