APIScanner

Last updated: Nov 20th, 2020
'

Towards Automated Detection of Deprecated APIs in Python Frameworks

What is APIScanner?

APIScanner is Visual Studio Code extension, that highlights the deprecated API elements used in python language. The current version only detects deprecated APIs present in six python frameworks - Scikit-learn, Numpy, Matplotlib, Pandas, Scipy, Seaborn

Features of APIScanner

  1. An algorithm to automatically identify deprecated APIs present source code of python library.

  2. Identifies the deprecated API elements present in the current active editor.

  3. On hover, hovercard pop-up shows the information regarding the deprecation (such as version in which it has been deprecated and any available replacement message provided by the library developer).

Uses of APIScanner

  1. Deprecated APIs are discouraged from being used in further software developments.

  2. To help developers mitigate the usage of deprecated APIs during new software developments, the developer must be aware of the usage of deprecated APIs in the project.

  3. Manually detecting and replacing deprecated APIs is a tedious and time-consuming task due to the large number of API calls used in the projects.

  4. With the help of APIScanner developers can identify the deprecated APIs in the developing phase.

Installation

Install from Marketplace

Click on APIScanner to download the extension from VS Code marketplace. Now, it will prompt you to install the extension in VS Code

Otherwise, In visual studio code, click (ctrl+shift+x) to open Extensions tab. Now search for APIScanner and install it.

Download Extension

Working of APIScanner

The approach followed by APIScanner is summarized below:

  1. In the current active editor, it extracts the import statements to identify the libraries being used in the current program.

  2. We then parse the soure code of library to generate Abstract Syntax Tree.

  3. We then extract all the deprecated API elements declared using the above three methods.

  4. APIScanner, now highlights all the deprecated API elements in the VS Code Editor, by matching with list of deprecated API elements we generated.

elegant icons

Source Code of APIScanner

Source code of the extension can be found here - APIScanner-Dev

  1. The file package.json triggers the extension, whenever python programming language used.

  2. out/commands/pyScripts contains the python scripts that generates the list of deprecated API elements.

  3. extension.ts file uses these list of deprecated API elements to highlight the usage of deprecated elements in the current active editor.

Results

Table I summarizes the total number of deprecated API elements detected by the Algorithm. The proposed algorithm identified 838 out of 871 API elements across six different Python libraries

Demonstration

Contributors

Aparna Vadlamani, Rishitha Kalicheti, Sridhar Chimalakonda
Research in Intelligent Software & Human Analytics (RISHA) Lab
Dept. of Computer Science & Engineering
Indian Institute of Technology Tirupati, Tirupati, India.
cs17b005@iittp.ac.in, cs17b014@iittp.ac.in, ch@iittp.ac.in