Skip to content

{Packaging} Build wheels with python -m build instead of python setup.py - #33941

Open
aryasadeghi1 wants to merge 2 commits into
Azure:devfrom
aryasadeghi1:build-wheels-with-pep517-frontend
Open

{Packaging} Build wheels with python -m build instead of python setup.py#33941
aryasadeghi1 wants to merge 2 commits into
Azure:devfrom
aryasadeghi1:build-wheels-with-pep517-frontend

Conversation

@aryasadeghi1

@aryasadeghi1 aryasadeghi1 commented Aug 20, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

scripts/ci/build.sh invoked python setup.py bdist_wheel / sdist directly. Setuptools 80+ deprecates running setup.py as a CLI and warns that these calls must be removed "to avoid build errors in the future", so drive the builds through the standard PEP 517 frontend instead.

Verified: wheels produced via python -m build --wheel --no-isolation are identical to the previous setup.py bdist_wheel output for all four distributions; same archive member list and same METADATA.

Related command

Description

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

…tup.py`

`scripts/ci/build.sh` invoked `python setup.py bdist_wheel` / `sdist` directly.
Setuptools 80+ deprecates running setup.py as a CLI and warns that these calls
must be removed "to avoid build errors in the future", so drive the builds
through the standard PEP 517 frontend instead.

`--no-isolation` preserves current behaviour: the build uses the setuptools
already installed by the caller rather than provisioning a fresh one. This keeps
each caller's setuptools pin in force and avoids requiring outbound network
access inside the packaging test containers.

`--wheel` and `--sdist` are separate invocations on purpose. A bare
`python -m build` builds an sdist first and then builds the wheel from it, which
would newly make MANIFEST.in correctness load-bearing.

`build` is added to the four scripts that run scripts/ci/build.sh, since none of
them installed the PEP 517 frontend.

Verified locally: wheels produced via `python -m build --wheel --no-isolation`
are identical to the previous `setup.py bdist_wheel` output for all four
distributions -- same archive member list and same METADATA.
@aryasadeghi1 aryasadeghi1 self-assigned this Aug 20, 2026
Copilot AI lite review requested due to automatic review settings August 20, 2026 10:17
@aryasadeghi1
aryasadeghi1 requested review from a team as code owners August 20, 2026 10:17
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi aryasadeghi1,
Since the current milestone time is less than 7 days, this pr may not catch up with this release.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates Azure CLI packaging automation to stop invoking setup.py directly (deprecated by newer setuptools) and instead build wheels/sdists via the standard PEP 517 frontend (python -m build). It also adjusts the release packaging test scripts so their container environments install the build frontend used by scripts/ci/build.sh.

Changes:

  • Switch scripts/ci/build.sh from python setup.py bdist_wheel/sdist to python -m build --wheel/--sdist --no-isolation.
  • Update RPM/AzureLinux, Debian, and Homebrew packaging test scripts to install the build package before invoking scripts/ci/build.sh.
  • Refresh inline comments in those scripts to reflect the new build mechanism.

Reviewed changes

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

Show a summary per file
File Description
scripts/release/rpm/test_rpm_in_docker.sh Installs build before running scripts/ci/build.sh; updates pin rationale comments.
scripts/release/rpm/test_azurelinux_in_docker.sh Installs build before running scripts/ci/build.sh; updates pin rationale comments.
scripts/release/homebrew/test_homebrew_package.sh Installs build alongside wheel for the packaging build step.
scripts/release/debian/test_deb_in_docker.sh Installs build alongside wheel for the packaging build step.
scripts/ci/build.sh Replaces setup.py CLI builds with python -m build --no-isolation for wheels and sdists.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/ci/build.sh
Comment on lines +55 to +59
# --no-isolation builds against the environment prepared by the caller rather than
# provisioning a fresh one, which keeps the caller's setuptools pin in force and
# avoids requiring outbound network access inside the packaging test containers.
python -m build --wheel --no-isolation --outdir $output_dir
python -m build --sdist --no-isolation --outdir $sdist_dir
Comment on lines +18 to +20
# Cap setuptools<81: 81 removes setup.py --dry-run and changes distutils command signatures (82 removes pkg_resources).
# scripts/ci/build.sh builds with `python -m build --no-isolation`, so this pin is the setuptools the build uses.
# `build` is the PEP 517 frontend that script invokes.
Comment on lines +18 to +20
# scripts/ci/build.sh builds with `python -m build --no-isolation`, so this pin is the setuptools the build uses.
# `build` is the PEP 517 frontend that script invokes.
python -m pip install --upgrade "setuptools<81" build
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@coopercox-ms Cooper Cox (coopercox-ms) added the Azure Client Tools Agent Requested Request Azure Client Tools Agent testing and review label Aug 20, 2026
@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Live test skipped

⏭️ Skipping the live test for this revision because no changed test file was found (tests/**/test_*.py).

The live-test pipeline runs only the test files a PR changes, so there is nothing to execute for this commit. A skipped live test is not a passing test result. The Agent review separately checks whether the affected command module includes focused regression tests or updated recordings. If a test file is changed in a later commit, the live test will run automatically.

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CI Review Summary

This PR is set up for human review (Azure Client Tools Agent Requested). Live test dispatch was skipped (no test files changed by this PR), so the test result below reflects upstream CI only.

Result: CI has failing checks — 4 of 64 checks failed.

Failed checks:

  • Azure.azure-cli — Build #20260820.31 failed (details)
  • Azure.azure-cli (Integration Test against Profiles Python312) — failed (details)
  • Azure.azure-cli (Integration Test against Profiles Python314) — failed (details)
  • Azure.azure-cli (Test Extensions Loading Python314) — failed (details)

Since this PR changes the wheel-build tooling (python -m build vs python setup.py), these failures likely stem from the packaging/build pipeline itself needing to pick up the new build invocation, or from downstream extension-loading/profile tests relying on the old build artifacts layout. Please inspect the build logs above to confirm whether the packaging change needs a corresponding CI pipeline update.

A human reviewer should look at the linked logs before this is merged.

@azure-client-tools-agent azure-client-tools-agent Bot added azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent and removed Azure Client Tools Agent Requested Request Azure Client Tools Agent testing and review labels Aug 21, 2026
@necusjz

Copy link
Copy Markdown
Member

@a0x1ab Aditya Pujara (a0x1ab) added Azure Client Tools Agent Requested Request Azure Client Tools Agent testing and review and removed azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent labels Aug 21, 2026

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CI Failures — 4 checks failed

The following CI checks failed for this PR (build #340095):

Check Result
Azure.azure-cli (main build) ❌ Failed — 3 errors / 4 warnings
Integration Test against Profiles Python312 ❌ Failed — 1 error
Integration Test against Profiles Python314 ❌ Failed — 1 error
Test Extensions Loading Python314 ❌ Failed — 1 error

Live test: Skipped (no changed test files detected in the PR).

What to investigate

The main build failure (3 errors / 4 warnings) and the integration/extension-loading failures on Python 3.12 and 3.14 suggest that switching from python setup.py to python -m build for wheel packaging is breaking the build or test environment setup. Common causes:

  • python -m build produces wheels in a different output path or format that the pipeline's install steps don't expect.
  • A dependency on setup.py-specific metadata (e.g. setup.py egg_info) that python -m build no longer emits.
  • Incompatibility between the new build backend and the Python 3.12 / 3.14 test environments.

Please review the full Azure DevOps build logs at the link above for the exact error messages, then update the PR to address each failure.

@azure-client-tools-agent azure-client-tools-agent Bot added azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent and removed Azure Client Tools Agent Requested Request Azure Client Tools Agent testing and review labels Aug 21, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-platform-engineering-squad.

@coopercox-ms

Copy link
Copy Markdown
Member

aryasadeghi1 can you fix the build failures indicated by the client tools agent. Thanks!

…/build.sh

scripts/ci/artifacts.sh sources scripts/ci/build.sh, so IntegrationTestAgainstProfiles and TestExtensionsLoading run the build too. Neither installed the PEP 517 frontend, so the build failed with 'No module named build'. Add it to both jobs, and provision it from build.sh when absent so the callers that no pipeline references (test_integration.sh, test_ref_doc.sh, the Windows MSI test flow) cannot hit the same failure.
@aryasadeghi1

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

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

Labels

act-platform-engineering-squad Auto-Assign Auto assign by bot azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent Packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants