CS Paper Radar

The Import Tax: A Longitudinal Measurement of Startup Cost in the Python Ecosystem

Trinath Sai Subhash Reddy Pittala

cs.SE ·submitted 2026-09-02 15:55 UTC · v2

Abstract

Python programs pay for their imports at every process start, a cost that is invisible in steady-state benchmarks but dominant for command-line tools, test workers, and serverless cold starts. Python 3.15 adds explicit lazy imports (PEP 810) on largely anecdotal evidence. We measure the import cost of the 500 most-downloaded PyPI packages, every quarterly release since mid-2021, under six CPython versions (3.9-3.14) on two platforms (Apple M5/macOS and Intel Xeon/Linux): all 66,816 package-version-interpreter cells, plus the release histories of 65 distributions beneath shared namespaces, and targeted experiments that isolate individual effects. Import cost is heavily skewed (median 12.3 ms, 99th percentile 400 ms on macOS). For the median package, 68-79% of import time is spent importing the standard library, while third-party dependencies are the largest component in the slowest decile. The cold first import is almost entirely bytecode compilation on Linux, but on macOS 67% of the cold penalty remains when bytecode is precompiled: we trace it to the operating system's security assessment of each new native library, which every fresh environment pays again. A package's own import code grows by a median 4.0-5.0% per year; resolving dependencies as of each release raises the median trend of the total from 1.8% to 3.0-3.4% per year. CPython 3.14 executes package code faster than 3.9 but imports more and slower standard-library modules, a net 1.16x slowdown on macOS and 1.07x on Linux. What dependents actually import from a package costs a median 1.0x its top-level import but 10.9-13.4x at the 90th percentile. Global lazy mode makes import statements essentially free and breaks 10 packages. Harness, analysis code, and dataset are public.

Comment
20 pages, 6 figures, 2 tables. v2: revised and extended (complete coverage, namespace-package histories, dependency drift on both platforms, trace-based attribution, macOS cold-start mechanism, usage-weighted submodule cost, CPython 3.15rc3 lazy-import census). Dataset and code: https://doi.org/10.5281/zenodo.23300556

Closest papers

Nearest neighbours by meaning across the whole index.

Python Import as an Execution Boundary: An Empirical Study of Bugs, Vulnerabilities, and Analysis Gaps

cs.CR ·2026-09-13 ·Baihong Chen, Wen Li
similarity 0.68
Abstract

Python import does more than resolve dependencies: it executes code during module and package initialization. This behavior can trigger failures, load dynamic or native code, access resources, or change security-sensitive state before an application calls a package API. Prior work studies package selection, malicious packages, or package vulnerabilities. We present ImportMine, a study of import-related bugs and security vulnerabilities in Python software. We combine security advisories with PyPI project histories and use source and patch evidence to confirm how import activates cases, why the problem occurs, how developers fix it, and what program information is needed to explain the behavior. We retain 31 import-related advisory vulnerabilities and 38 application-data boundary cases and confirm 1,429 project-history bugs across 1,302 repositories. Among the project-history bugs activated during initialization, 97.6% stop or disrupt normal execution. In contrast, 90.0% of the 20 initialization- activated advisory vulnerabilities are High or Critical. Module-level code and package initialization activate 98.3% of the analyzed history cases. Dynamic loading is much less common, but most of its cases perform security-sensitive actions. We also find that many fixes change when an import becomes active instead of removing the dependency. Finally, we derive ImportVulBench, 228 paired pre-fix and fixed programs covering all 11 bug types.

0.23

Beyond Source: An Empirical Study of Python Bytecode Security Risks

cs.CR ·2026-08-13 ·Baihong Chen, Tian Xie, Wen Li
similarity 0.64
Abstract

Python package security is largely source-centric, yet Python runtimes can execute bytecode directly through .pyc files, compiled-only modules, and marshalled code objects, creating an inspection-execution gap. We present an empirical study of Python bytecode as a security artifact. We measure bytecode exposure in PyPI distributions, evaluate practical analyzability using version-aware tooling, assess CPython runtime robustness under adversarial bytecode, and test source-level reproduction of bytecode findings. Across 1,034,843 collected PyPI artifacts, we identify 7,388 bytecode-containing artifacts, including 228,578 .pyc files and 28,193 artifact-local source-less .pyc files. For modern CPython 3.8-3.14 bytecode, at least one selected decompiler emits source for 204,901 of 204,904 in-scope files, a result measuring emission rather than verified functional equivalence. Tools are non-robust: observed PyPI bytecode triggers managed-code exceptions and timeouts, while adversarial mutated bytecode also drives decompilers into native process failures; together these outcomes yield 17 distinct robustness signatures. Fuzzing produces 1,009 stack-deduplicated runtime findings dominated by pointer-dereference symptoms; 261 groups exhibit potential memory-corruption characteristics, and at least 91.7% of groups reach execution beyond the documented-unsafe ingestion boundary. None reproduce from ordinary Python source. Bytecode is thus a visible ecosystem artifact, a practical analysis target, and a security-relevant interpreter input whose behavior need not match source-level behavior.

0.37

Evolution of Deprecated APIs and Their Replacements in Python Libraries

cs.SE ·2026-09-26 ·Gangqiang He, Guanping Xiao
similarity 0.56
Abstract · 18 pages, 11 figures

Context: API deprecation is common in library evolution, but migration requires finding replacements and adapting calls. Prior studies examine deprecation, replacement identification, and client migration separately, leaving deprecated API-replacement API relationships across releases and lifecycle states insufficiently understood. Objective: We examine replacement locality, parameter-interface differences, changes in replacement rankings across versions, and post-deprecation lifecycles from source-definition and original-invocation perspectives. Method: We construct 830 maintainer-specified mappings from 33 Python libraries, covering classes, functions, and methods. We compare definitions, track similarity-based rankings under two migration scenarios, and identify lifecycle events through source inspection and release-by-release execution. Results: Same-module replacements account for 39.1%, 55.6%, and 79.9% of class, function, and method mappings, respectively. Most mappings have no parameter changes, but function mappings show more frequent and diverse changes. Rankings vary across releases and code representations, and the applicable methods agree on the overall trend in only about 60% of cases. Other-candidate effects are dominant or mixed in 49.0% of key versions. After deprecation, 56.4% of mappings retain the source definition and 68.6% retain an executable original invocation. Among 753 mappings with at least one observed ending event, 25.2% are source-first or invocation-first rather than same-release. Of these cases, 77.4% are source-first. Conclusions: Deprecated API-replacement API relationships depend on API granularity, release context, code representation, candidate competition, and lifecycle state. These results support evolution-aware replacement API recommendation and automated API migration.

0.24

Trouble at the top: can Python extend the chains of trust in infrastructure firmware?

cs.CR ·2026-08-17 ·Larry Hernandez, Sergey Bratus
published similarity 0.56
Abstract · Work in progress. Presented at the 2026 Symposium on the Science of Security (HotSoS 2026), Session 2, April 14, 2026. Session listing: http…

Compiled Python bytecode (PYC) has become an essential part of network switches, routers, and other network infrastructure devices. Our analysis shows that its integrity is implicitly trusted in multiple designs that make use of Python code at the top of the operational software, such as the management and control pane of enterprise network switches. At the same time, the integrity of PYC files is not covered under the traditional chain-of-trust models, due to complex interactions with the CPython loader, byte compiler, and other Python runtime components. We explore the risks inherent in including PYC and Python runtimes in the de facto trusted code basis of commercial enterprise equipment and offer a comprehensive framework for understanding emergent behaviors in these designs.

0.27

Reducing Cold-Start Latency in Serverless Applications via Dynamic Slicing

cs.DC cs.PLcs.SE ·2026-09-12 ·Georgios Alexopoulos, Konstantinos Karakatsanis, Nikolaos Alexopoulos, Dimitris Mitropoulos, Thodoris Sotiropoulos
similarity 0.56
Abstract

We present PyXtrim, a system that reduces the cold-start latency of serverless applications through debloating. We focus on Python, a dominant language for serverless applications whose dynamic features and extensive use of native extensions make traditional static debloating particularly challenging. PyXtrim frames debloating as a dynamic slicing problem, using the application's externally visible behavior as the slicing criterion. Everything outside the resulting slice is removed, both from the application and its dependencies. Our key technical contribution is that the slice is computed by a cross-language dynamic dependence engine that tracks data and control dependences across Python and native code and identifies operations that interact with the operating system, which form the slicing criterion. As a result, PyXtrim can effectively handle real-world applications that rely on dynamic features such as reflection, interoperate with native code and interact with system resources. Across 31 applications on AWS Lambda, PyXtrim reduces cold-start latency by 21.7% and peak memory usage by 17.1% at the median. This is more than double the reduction achieved by the state of the art, while debloating each application in minutes.

0.17

SMTpip: Interpreter-Aware SMT-Based Dependency Conflict Resolution for Restoring Python Source-Code Executability

cs.SE cs.LO ·2026-08-16 ·Sadman Jashim Sakib, Muhammad Asaduzzaman, Curtis Bright
code/data similarity 0.55
Abstract

Software developers rely on packages to reuse existing functionality instead of implementing everything from scratch. Python developers commonly provide package and interpreter dependencies using configuration files, such as requirements.txt or setup.py. Package managers in Python, such as pip, can install packages according to dependency and interpreter version constraints specified in configuration files. However, Python dependency resolution remains challenging: (1) different packages may require incompatible versions of the same dependency; (2) dependencies may require a Python interpreter version that is incompatible with the interpreter used for the project, making a valid environment impossible; and (3) pip, the most popular Python package manager, resolves conflicts via backtracking, repeatedly trying candidate versions without knowing whether a valid execution environment exists or not. To address these challenges, we present SMTpip, an interpreter-aware environment inference technique for improving the executability of Python source-code artifacts. SMTpip constructs a dependency knowledge graph using metadata stored in the Python Package Index (PyPI) that hosts millions of package releases, encodes both package version constraints and interpreter compatibility constraints specified in configuration files into Satisfiability Modulo Theories (SMT) formulas. Solving these formulas identifies a set of package versions and an interpreter version that jointly satisfy all declared constraints. Empirical evaluation on multiple datasets from open-source Python projects shows that SMTpip achieves substantial speedups -- $6.9\times$ over pip, $9.6\times$ over Conda, $3.2\times$ over smartPip, and $4\times$ over PyEGo -- while consistently producing constraint-consistent environments.

0.20

How Python Audio Libraries Change Across Releases: Module Structure and Documentation

cs.SE ·2026-11-03 ·Mateusz Modrzejewski, Michał Rokita, Łukasz Neumann
similarity 0.55
Abstract

Developers who upgrade a Python audio library need to know what changed in the code they import and whether the release notes say so. Release notes and breaking changes have been mined for general software, but the module structure of audio libraries and its documentation have not been studied together. We mine 56 audio repositories used in machine learning workflows: the import graph of 49 packages at 1,395 releases, joined to 20,864 release-note and changelog entries, labeled by three open-weight language models and checked against two human coders. We find that (1) the set of a package's top-level modules is unchanged in 86.1% of consecutive release pairs, while the set of module files is unchanged in 61.4%. (2) A major increment changes the top level 5.2 times as often as another increment, and major and 0.x minor increments together account for 48.7% of the observed changes. (3) When a release removes modules, its notes name 8.9% of the removal units under a lexical match, an estimated 4.3% after a hand check of the matches. (4) Longer notes are more likely to contain an entry labeled as structural, and within each length band this proportion is also higher for releases with module removals. We intend to release the aligned dataset and the pipeline

0.25

Escaping Python Dependency Hell: A Hybrid Replay-and-Repair Pipeline for Python Dependency Resolution

cs.AI cs.MAcs.SE ·2026-09-22 ·Veronica Poweska, Ariana Oyanguren, Jessica Pourleyli, Sourena Khanzadeh, Manar Alalfi
benchmark similarity 0.54
Abstract

Dependency conflicts in Python ecosystems arise from incompatible version constraints, missing packages, and undocumented compatibility relationships, causing many real-world code snippets to fail at execution. This paper presents PLLM+, a hybrid dependency-repair pipeline evaluated on the HG2.9K benchmark of 2,891 dependency-failing snippets. PLLM+ prioritizes inexpensive deterministic steps before invoking LLM-based repair: static AST-based interpreter inference, replay of historically successful dependency configurations from the competition-provided solutions database, and live PyPI validation of candidate package versions. When these steps do not resolve a case, the system falls back to a structured LLM-based repair loop with typed error classification and Proposer/Critic agents. On HG2.9K, PLLM+ solves 1,500 out of 2,891 snippets, compared with 1,169 solved by the PLLM baseline. It also reduces average runtime from 368.7 to 71.8 seconds per snippet. Most successful fixes come from replaying known configurations: 1,495 of the 1,500 successful fixes are produced by the solutions database, while the LLM fallback accounts for 5 additional fixes. These results suggest that, in this benchmark setting, deterministic reuse of previously validated dependency configurations is a simple and effective strategy, with LLM-based repair serving as a secondary fallback for cases not covered by prior solutions.

0.14