From e64a6c9e334000cee008e74a3bb9ccad99c12c86 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 3 Apr 2026 00:23:27 +0000 Subject: [PATCH 1/4] patch the py2docfx reqs so that we have this cached locally --- eng/scripts/docs/py2docfx_requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eng/scripts/docs/py2docfx_requirements.txt b/eng/scripts/docs/py2docfx_requirements.txt index fd2c0a2051f7..a0481f76cebb 100644 --- a/eng/scripts/docs/py2docfx_requirements.txt +++ b/eng/scripts/docs/py2docfx_requirements.txt @@ -1 +1,3 @@ py2docfx==0.1.24 +setuptools==77.0.3 +wheel==0.45.1 From c5ab8d872b4c1f16f12e37ffd198cb38a509ceaf Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 3 Apr 2026 01:46:20 +0000 Subject: [PATCH 2/4] lets see about disabling build isolation --- eng/pipelines/templates/stages/archetype-python-release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/pipelines/templates/stages/archetype-python-release.yml b/eng/pipelines/templates/stages/archetype-python-release.yml index 4cf30f556912..67adf746a17a 100644 --- a/eng/pipelines/templates/stages/archetype-python-release.yml +++ b/eng/pipelines/templates/stages/archetype-python-release.yml @@ -280,6 +280,10 @@ stages: inputs: versionSpec: '3.11' + - pwsh: | + Write-Host "##vso[task.setvariable variable=PIP_NO_BUILD_ISOLATION]1" + displayName: 'Set PIP_NO_BUILD_ISOLATION=1 for py2docfx' + - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml From ff24350a6145c179c456eaba6d8894d3d4f33987 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 3 Apr 2026 21:54:00 +0000 Subject: [PATCH 3/4] patch py2docfx, does this work? --- .../stages/archetype-python-release.yml | 4 --- .../steps/install-rex-validation-tool.yml | 25 ++++++++++++++++++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-python-release.yml b/eng/pipelines/templates/stages/archetype-python-release.yml index 67adf746a17a..4cf30f556912 100644 --- a/eng/pipelines/templates/stages/archetype-python-release.yml +++ b/eng/pipelines/templates/stages/archetype-python-release.yml @@ -280,10 +280,6 @@ stages: inputs: versionSpec: '3.11' - - pwsh: | - Write-Host "##vso[task.setvariable variable=PIP_NO_BUILD_ISOLATION]1" - displayName: 'Set PIP_NO_BUILD_ISOLATION=1 for py2docfx' - - template: /eng/pipelines/templates/steps/install-rex-validation-tool.yml - template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml index f447b4dfca48..299d82936cd3 100644 --- a/eng/pipelines/templates/steps/install-rex-validation-tool.yml +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -2,7 +2,30 @@ steps: - pwsh: | Write-Host "python -m pip install -r eng/scripts/docs/py2docfx_requirements.txt" python -m pip install -r eng/scripts/docs/py2docfx_requirements.txt - # After install py2docfx, + + # Patch py2docfx to add --no-build-isolation to pip download commands. + # When py2docfx downloads sdists with --no-binary=:all:, pip enters build isolation + # and spawns nested subprocesses that inherit --extra-index-url. These nested + # subprocesses hit the Azure DevOps feed without auth, causing 401 errors that + # result in EOFError when pip tries to prompt for credentials in a non-interactive + # environment. Adding --no-build-isolation makes pip reuse the already-installed + # setuptools and wheel from the outer environment, avoiding the auth cascade. + $pipUtilsPath = python -c "import py2docfx.convert_prepare.pip_utils as m; print(m.__file__)" + Write-Host "Patching py2docfx pip_utils.py at: $pipUtilsPath" + $content = Get-Content -Raw $pipUtilsPath + $original = ' download_param.append("--no-binary=:all:")' + $patched = @" + download_param.append("--no-binary=:all:") + download_param.append("--no-build-isolation") + "@ + if ($content.Contains($original)) { + $content = $content.Replace($original, $patched) + Set-Content -Path $pipUtilsPath -Value $content -NoNewline + Write-Host "Successfully patched py2docfx to add --no-build-isolation" + } else { + Write-Host "##vso[task.logissue type=warning]Could not find expected pattern in pip_utils.py to patch. py2docfx may have been updated." + } + Write-Host "Testing the install. Running python -m py2docfx -h to display the help" python -m py2docfx -h displayName: Install py2docfx for package validation From 8c80b977bcfe13dc1e3e4bbaa7be01ecb4c59d78 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 3 Apr 2026 23:57:38 +0000 Subject: [PATCH 4/4] trying patcher again --- .../templates/steps/install-rex-validation-tool.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml index 299d82936cd3..0555944a716b 100644 --- a/eng/pipelines/templates/steps/install-rex-validation-tool.yml +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -14,10 +14,7 @@ steps: Write-Host "Patching py2docfx pip_utils.py at: $pipUtilsPath" $content = Get-Content -Raw $pipUtilsPath $original = ' download_param.append("--no-binary=:all:")' - $patched = @" - download_param.append("--no-binary=:all:") - download_param.append("--no-build-isolation") - "@ + $patched = $original + "`n" + ' download_param.append("--no-build-isolation")' if ($content.Contains($original)) { $content = $content.Replace($original, $patched) Set-Content -Path $pipUtilsPath -Value $content -NoNewline