Adaptoring: Adapter Generation to Provide an Alternative API for a
Library
- URL: http://arxiv.org/abs/2401.07053v1
- Date: Sat, 13 Jan 2024 11:48:45 GMT
- Title: Adaptoring: Adapter Generation to Provide an Alternative API for a
Library
- Authors: Lars Reimann, G\"unter Kniesel-W\"unsche
- Abstract summary: Third-party libraries are a cornerstone of fast application development.
An obscure API instead slows down the learning process and can lead to erroneous use.
This paper explores the use of the adapter pattern to provide a new API as a new library that calls the original library internally.
- Score: 5.710971447109951
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: Third-party libraries are a cornerstone of fast application development. To
enable efficient use, libraries must provide a well-designed API. An obscure
API instead slows down the learning process and can lead to erroneous use.
The usual approach to improve the API of a library is to edit its code
directly, either keeping the old API but deprecating it (temporarily increasing
the API size) or dropping it (introducing breaking changes). If maintainers are
unwilling to make such changes, others need to create a hard fork, which they
can refactor. But then it is difficult to incorporate changes to the original
library, such as bug fixes or performance improvements.
In this paper, we instead explore the use of the adapter pattern to provide a
new API as a new library that calls the original library internally. This
allows the new library to leverage all implementation changes to the original
library, at no additional cost. We call this approach adaptoring. To make the
approach practical, we identify API transformations for which adapter code can
be generated automatically, and investigate which transformations can be
inferred automatically, based on the documentation and usage patterns of the
original library. For cases where automated inference is not possible, we
present a tool that lets developers manually specify API transformations.
Finally, we consider the issue of migrating the generated adapters if the
original library introduces breaking changes. We implemented our approach for
Python, demonstrating its effectiveness to quickly provide an alternative API
even for large libraries.
Related papers
- Your Fix Is My Exploit: Enabling Comprehensive DL Library API Fuzzing with Large Language Models [49.214291813478695]
Deep learning (DL) libraries, widely used in AI applications, often contain vulnerabilities like overflows and use buffer-free errors.
Traditional fuzzing struggles with the complexity and API diversity of DL libraries.
We propose DFUZZ, an LLM-driven fuzzing approach for DL libraries.
arXiv Detail & Related papers (2025-01-08T07:07:22Z) - ExploraCoder: Advancing code generation for multiple unseen APIs via planning and chained exploration [70.26807758443675]
ExploraCoder is a training-free framework that empowers large language models to invoke unseen APIs in code solution.
We show that ExploraCoder significantly improves performance for models lacking prior API knowledge, achieving an absolute increase of 11.24% over niave RAG approaches and 14.07% over pretraining methods in pass@10.
arXiv Detail & Related papers (2024-12-06T19:00:15Z) - A Systematic Evaluation of Large Code Models in API Suggestion: When, Which, and How [53.65636914757381]
API suggestion is a critical task in modern software development.
Recent advancements in large code models (LCMs) have shown promise in the API suggestion task.
arXiv Detail & Related papers (2024-09-20T03:12:35Z) - Recommending Analogical APIs via Knowledge Graph Embedding [10.131362518700403]
We build KGE4AR' s unified API KG for 35,773 Java libraries and assess it in two API recommendation scenarios.
Our results show that KGE4AR substantially outperforms state-of-the-art documentation-based techniques in terms of all metrics.
arXiv Detail & Related papers (2023-08-22T13:12:13Z) - Private-Library-Oriented Code Generation with Large Language Models [52.73999698194344]
This paper focuses on utilizing large language models (LLMs) for code generation in private libraries.
We propose a novel framework that emulates the process of programmers writing private code.
We create four private library benchmarks, including TorchDataEval, TorchDataComplexEval, MonkeyEval, and BeatNumEval.
arXiv Detail & Related papers (2023-07-28T07:43:13Z) - torchgfn: A PyTorch GFlowNet library [56.071033896777784]
torchgfn is a PyTorch library that aims to address this need.
It provides users with a simple API for environments and useful abstractions for samplers and losses.
arXiv Detail & Related papers (2023-05-24T00:20:59Z) - SequeL: A Continual Learning Library in PyTorch and JAX [50.33956216274694]
SequeL is a library for Continual Learning that supports both PyTorch and JAX frameworks.
It provides a unified interface for a wide range of Continual Learning algorithms, including regularization-based approaches, replay-based approaches, and hybrid approaches.
We release SequeL as an open-source library, enabling researchers and developers to easily experiment and extend the library for their own purposes.
arXiv Detail & Related papers (2023-04-21T10:00:22Z) - Neural Transition-based Parsing of Library Deprecations [3.6382354548339295]
This paper tackles the problem of automating code updates to fix deprecated API usages of open source libraries by analyzing their release notes.
Our system employs a three-tier architecture: first, a web crawler service retrieves deprecation documentation from the web; then a specially built text processes those documents into tree-structured representations.
To confirm the effectiveness of our method, we gathered and labeled a set of 426 API deprecations from 7 well-known Python data science libraries, and demonstrated our approach decisively outperforms a non-trivial neural machine translation baseline.
arXiv Detail & Related papers (2022-12-23T20:48:33Z) - PyTorch Adapt [37.03614011735927]
PyTorch Adapt is a library for domain adaptation.
domain adaptation is a type of machine learning algorithm that re-purposes existing models to work in new domains.
It is a fully-featured toolkit, allowing users to create a complete train/test pipeline in a few lines of code.
arXiv Detail & Related papers (2022-11-28T18:59:09Z) - Characterizing Python Library Migrations [2.2557806157585834]
We label 3,096 migration-related code changes in 335 Python library migrations.
We find that 40% of library pairs have API mappings that involve non-function program elements.
On average, a developer needs to learn about 4 APIs and 2 API mappings to perform a migration.
arXiv Detail & Related papers (2022-07-03T21:00:08Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.