Skip to content

Commit d99596b

Browse files
[apiview-stub-generator] Use uv for package install; revert timeout to 120s (#16429)
Install the target package with 'uv pip install' when uv is available (falling back to pip otherwise). uv's resolver is far faster than pip's for large, beta-pinned dependency trees such as the Microsoft OpenTelemetry distro, where pip spent minutes backtracking (observed ~370s for azure-ai-agentserver-core). With uv this drops to seconds, so the elevated install timeout is no longer needed and is reverted from 300s back to 120s. Bumps version to 0.3.30.
1 parent c8815db commit d99596b

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

packages/python-packages/apiview-stub-generator/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Release History
22

3+
## Version 0.3.30 (2026-07-21)
4+
Use `uv pip install` (when `uv` is available) instead of `pip` to install the target package before generating the API view. `uv`'s dependency resolver is dramatically faster than pip's for large, beta-pinned dependency trees (e.g. the Microsoft OpenTelemetry distro), where pip could spend several minutes backtracking over candidate versions. This removes the need for the elevated install timeout, which is reverted to 120s. Falls back to `pip install` when `uv` is not on PATH.
5+
36
## Version 0.3.29 (2026-07-17)
47
Raised the package-install timeout in the API-stub generator from 120s to 300s. Packages with large dependency trees (e.g. those pulling the Microsoft OpenTelemetry distro) could exceed the previous 120s limit on slower CI agents even though the install was healthy, causing spurious API Review failures.
58

packages/python-packages/apiview-stub-generator/apistub/_stub_generator.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,15 @@ def _get_package_name_from_metadata_files(self, path):
449449
return pkg_name
450450

451451
def _install_package(self):
452-
commands = [sys.executable, "-m", "pip", "install", self.pkg_path, "-q"]
453-
# Packages with large dependency trees (e.g. those pulling the Microsoft
454-
# OpenTelemetry distro) can exceed a short install timeout on slower CI
455-
# agents even though the install is healthy — the same install has been
456-
# observed to take 35s on one agent and 136s on another. Use 300s to
457-
# avoid spurious API Review failures.
458-
result = run(commands, timeout=300, stderr=PIPE, text=True)
452+
# Prefer `uv pip install` when uv is available: its dependency resolver is
453+
# dramatically faster than pip's for large, beta-pinned trees (e.g. the
454+
# Microsoft OpenTelemetry distro), where pip can spend minutes backtracking
455+
# over candidate versions. Fall back to `pip install` when uv is not on PATH.
456+
if shutil.which("uv") is not None:
457+
commands = ["uv", "pip", "install", "--python", sys.executable, self.pkg_path, "-q"]
458+
else:
459+
commands = [sys.executable, "-m", "pip", "install", self.pkg_path, "-q"]
460+
result = run(commands, timeout=120, stderr=PIPE, text=True)
459461
if result.stderr:
460462
logging.debug("pip stderr: %s", result.stderr.strip())
461463
if result.returncode != 0:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
VERSION = "0.3.29"
4+
VERSION = "0.3.30"

0 commit comments

Comments
 (0)