Skip to content

Skip cibuildwheel for dev-requirement wheels with C extensions#47090

Open
l0lawrence wants to merge 1 commit into
Azure:mainfrom
l0lawrence:fix-cibuildwheel-dev-reqs
Open

Skip cibuildwheel for dev-requirement wheels with C extensions#47090
l0lawrence wants to merge 1 commit into
Azure:mainfrom
l0lawrence:fix-cibuildwheel-dev-reqs

Conversation

@l0lawrence
Copy link
Copy Markdown
Member

Problem

The internal storage SDK pipeline fails on every PR that touches a package whose dev_requirements.txt includes azure-storage-extensions (e.g. azure-storage-queue, azure-storage-blob, azure-storage-file-datalake).

The failure occurs in dispatch_checks.pyreplace_dev_reqsbuild_whl_for_reqcreate_package. Because azure-storage-extensions defines a crc64 C extension module, create_package routes the wheel build through cibuildwheel. On Windows, cibuildwheel downloads its own CPython from api.nuget.org via NuGet, but the internal 1ES pool agents block outbound to api.nuget.org (DNS returns RFC-5737 sinkhole 192.0.2.9 and the firewall denies the connection):

Unable to load the service index for source https://api.nuget.org/v3/index.json.
  An error occurred while sending the request.
  Unable to connect to the remote server
  An attempt was made to access a socket in a way forbidden by its access permissions 192.0.2.9:443

Fix

cibuildwheel is designed for producing release artifacts that span multiple Python versions and ABIs. For dev-requirement builds, the wheel only needs to install into the current test venv with the current Python — so the cibuildwheel-driven download of an isolated CPython is unnecessary.

This PR adds a use_cibuildwheel parameter to create_package (defaulting to True so release builds keep using cibuildwheel) and has build_whl_for_req (the dev-requirements path) pass use_cibuildwheel=False. When the flag is off and the package has ext_modules, the build falls through to setup.py bdist_wheel with the invoking Python, which works fine in-venv and needs no nuget.org access.

Impact

  • Release pipeline (build_packages): unchanged — still produces the abi3 wheel for azure-storage-extensions via cibuildwheel on the public-CI agent that can reach nuget.org.
  • Dev-requirements installs (build_whl_for_req): now build the local ext-module package with the invoking Python — no nuget download, works on the internal 1ES pool.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

`cibuildwheel` downloads its own CPython from nuget.org which is not reachable from internal 1ES pool agents (egress returns RFC-5737 sinkhole IPs). For dev-requirement builds the wheel only needs to install into the current venv, so opt out of cibuildwheel and let `setup.py bdist_wheel` run with the invoking Python. Release builds (`build_packages`) keep the default behavior so they continue to produce the abi3 wheel via cibuildwheel on agents that can reach nuget.org.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 22, 2026 20:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Azure SDK Python tooling used in CI to avoid using cibuildwheel when building wheels for dev-requirements that include C extensions (notably azure-storage-extensions), addressing failures on internal Windows agents that cannot reach api.nuget.org.

Changes:

  • Added a use_cibuildwheel flag to ci_tools.build.create_package (defaulting to True to preserve release behavior).
  • Updated dev-requirements wheel building (build_whl_for_req) to call create_package(..., use_cibuildwheel=False) so C-extension wheels are built with the invoking Python instead of cibuildwheel.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
eng/tools/azure-sdk-tools/ci_tools/scenario/generation.py Disables cibuildwheel when building dev-requirements wheels so builds work on restricted internal agents.
eng/tools/azure-sdk-tools/ci_tools/build.py Introduces use_cibuildwheel and gates the cibuildwheel path for extension-module wheels behind this flag.

Comment on lines +354 to +357
# Python versions; it downloads its own CPython from nuget.org which is not
# reachable from all CI agents. For dev-requirements builds the wheel only needs
# to install into the current venv, so opt out of ``cibuildwheel`` here and let
# ``setup.py bdist_wheel`` run with the invoking Python.
Comment on lines +231 to +235
When ``use_cibuildwheel`` is False, packages with C extension modules are built with the
invoking Python via ``setup.py bdist_wheel`` instead of ``cibuildwheel``. This is the
appropriate choice when the wheel is only consumed by the current venv (e.g. dev-requirement
installs in CI), since ``cibuildwheel`` otherwise downloads a fresh CPython from nuget.org
which is not reachable from all CI agents.
@l0lawrence
Copy link
Copy Markdown
Member Author

/azp run python - storage - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants