Availability and Usage of Platform-Specific APIs: A First Empirical Study (MSR 2024)
andrehoraa
98 views
12 slides
Jul 25, 2024
Slide 1 of 12
1
2
3
4
5
6
7
8
9
10
11
12
About This Presentation
A platform-specific API is an API implemented for a particular platform (e.g., operating system), therefore, it may not work on other platforms than the target one. In this paper, we propose a first empirical study to assess the availability and usage of platform-specific APIs. We analyze the platfo...
A platform-specific API is an API implemented for a particular platform (e.g., operating system), therefore, it may not work on other platforms than the target one. In this paper, we propose a first empirical study to assess the availability and usage of platform-specific APIs. We analyze the platform-specific APIs provided by the Python Standard Library and mine their usage in 100 popular systems. We find that 21% of the Python Standard Library APIs are platform-specific and that 15% of the modules contain at least one. The platforms with the most availability restrictions are WASI (43.69%), Emscripten (43.64%), Unix (6,76%), and Windows (2.12%). Moreover, we find that platform-specific APIs are largely used in Python. We detect over 19K API usages in all 100 projects, in both production (52.6%) and test code (47.4%). We conclude by discussing practical implications for practitioners and researchers.
Size: 5.09 MB
Language: en
Added: Jul 25, 2024
Slides: 12 pages
Slide Content
Availability and Usage of Platform-Specific APIs:
A First Empirical Study
Ricardo Job and André Hora
Software Runs on Multiple Platforms
2
Diversity of Development Environments
https://www.jetbrains.com/lp/devecosystem-2023/development/#os_devenv
Platform-Specific API
API that is implemented for a particular platform,
therefore, it may not work on other platforms than the
target one.
3
signal.setitimer
if sys.platform != "win32":
# Clear the alarm signal set by
# ioloop.set_blocking_log_threshold so it doesn't fire
# after the exec.
signal.setitimer(signal.ITIMER_REAL, 0, 0)
4https://github.com/tornadoweb/tornado/blob/f5df43f26bb4d00759176f7cbec8bdce69f2f4f/tornado/autoreload.py#L206-L210
Platform-Specific APIs
The Python Standard Library Documentation (version 3.11)
5
https://docs.python.org/3.11/library/
Platform-Specific APIs
6
RQ1: What is the availability of platform-specific APIs?
RQ2: What is the usage of platform-specific APIs?
RQ1: Availability of Platform-Specific APIs
Study Design
7
availability notes
8,795 APIs
1,841 Platform-Specific APIs
version 3.11
RQ1: Availability of Platform-Specific APIs
Major Findings
8
21% of the APIs are platform-specific.
15% of the modules contain at least one platform-specific API.
17 different platforms with availability restrictions.
RQ2: Usage of Platform-Specific APIs
Study Design
9
AST-based
analysis
1,841
Platform-Specific APIs
100
Software Systems
19,288
Usage instances
683
Distinct Platform-Specific APIs
RQ2: Usage of Platform-Specific APIs
Major Findings
10
Platform-specific APIs are largely used in Python.
19K usages of platform-specific APIs in all 100 projects.
Top-3: asyncio.sleep, subprocess.Popen, and subprocess.PIPE.
Implications
Practitioners and Researchers
•Platform-specific APIs are widespread in the Python Standard
Library but there is a lack of dedicated documentation.
•Platform-specific APIs are largely used by Python systems but
there is an absence of best practices and anti-patterns.
11
Availability and Usage of Platform-Specific APIs:
A First Empirical Study [email protected]