Skip to content

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

Open
aryasadeghi1 wants to merge 1 commit 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 1 commit 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).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants