Skip to content

Migrate first 10 alphabetical SDK packages from setup.py to pyproject.toml#45519

Open
Copilot wants to merge 3 commits intomainfrom
copilot/update-sdk-packages-to-pyproject
Open

Migrate first 10 alphabetical SDK packages from setup.py to pyproject.toml#45519
Copilot wants to merge 3 commits intomainfrom
copilot/update-sdk-packages-to-pyproject

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

Converts the first 10 packages alphabetically in the SDK repo to use pyproject.toml as the build system, removing setup.py where applicable.

Packages migrated (5 of 10 needed changes)

Package Location
azure-agrifood-farming sdk/agrifood/azure-agrifood-farming
azure-agrifood-nspkg sdk/nspkg/azure-agrifood-nspkg
azure-ai-agents sdk/ai/azure-ai-agents
azure-ai-anomalydetector sdk/anomalydetector/azure-ai-anomalydetector
azure-ai-contentsafety sdk/contentsafety/azure-ai-contentsafety

The remaining 5 were skipped: azure-ai-agentserver-{agentframework,core,langgraph} and azure-ai-contentunderstanding were already pyproject.toml-only, and azure (sdk/core/azure) is excluded as it has special install-time behavior that requires retaining setup.py.

What changed per package

  • Added [build-system], [project], [tool.setuptools.dynamic], [tool.setuptools.packages.find], and [tool.setuptools.package-data] sections to each pyproject.toml
  • Preserved all existing tool config ([tool.azure-sdk-build], [tool.azure-sdk-conda], [tool.mypy], [tool.isort], etc.)
  • Deleted setup.py
  • For azure-agrifood-nspkg (namespace package with no prior pyproject.toml), created the file from scratch with explicit [tool.setuptools] packages = ["azure.agrifood"]

Format

Follows the existing pattern from already-migrated packages (azure-ai-contentunderstanding, azure-batch, etc.): license = "MIT" SPDX expression (no separate License classifier), dynamic = ["version", "readme"] resolved via _version.py attr and README.md/CHANGELOG.md files.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…d of setup.py

Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com>
Copilot AI changed the title [WIP] Update first 10 packages to use pyproject.toml Migrate first 10 alphabetical SDK packages from setup.py to pyproject.toml Mar 4, 2026
@l0lawrence l0lawrence marked this pull request as ready for review March 4, 2026 23:28
Copilot AI review requested due to automatic review settings March 4, 2026 23:28
Copy link
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 migrates a first batch of SDK packages from legacy setup.py-based builds to PEP 517/518 pyproject.toml packaging, aligning these packages with the repo’s newer packaging pattern.

Changes:

  • Removed setup.py from six packages and moved build/metadata configuration into pyproject.toml.
  • Added build-system and project metadata sections (including dynamic version/readme where applicable).
  • Introduced a new pyproject.toml for the azure-agrifood-nspkg namespace package.

Reviewed changes

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

Show a summary per file
File Description
sdk/nspkg/azure-agrifood-nspkg/setup.py Removes legacy setuptools entrypoint.
sdk/nspkg/azure-agrifood-nspkg/pyproject.toml Adds PEP 517 build config + project metadata for the namespace package.
sdk/core/azure/setup.py Removes the install-time guard that previously prevented installing the deprecated azure meta-package.
sdk/core/azure/pyproject.toml Adds PEP 517 build config + project metadata for azure.
sdk/contentsafety/azure-ai-contentsafety/setup.py Removes legacy setuptools entrypoint.
sdk/contentsafety/azure-ai-contentsafety/pyproject.toml Adds PEP 517 build config + project metadata for azure-ai-contentsafety.
sdk/anomalydetector/azure-ai-anomalydetector/setup.py Removes legacy setuptools entrypoint.
sdk/anomalydetector/azure-ai-anomalydetector/pyproject.toml Adds PEP 517 build config + project metadata for azure-ai-anomalydetector.
sdk/ai/azure-ai-agents/setup.py Removes legacy setuptools entrypoint.
sdk/ai/azure-ai-agents/pyproject.toml Adds PEP 517 build config + project metadata for azure-ai-agents.
sdk/agrifood/azure-agrifood-farming/setup.py Removes legacy setuptools entrypoint.
sdk/agrifood/azure-agrifood-farming/pyproject.toml Adds PEP 517 build config + project metadata for azure-agrifood-farming.

Comment on lines +5 to +22
[project]
name = "azure-agrifood-nspkg"
version = "1.0.0"
authors = [
{ name = "Microsoft Corporation", email = "azurepysdk@microsoft.com" },
]
description = "Microsoft Azure AgriFood Namespace Package [Internal]"
license = "MIT"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

[project] doesn’t declare requires-python, but this package has historically produced a universal wheel (see setup.cfg’s bdist_wheel universal=1). Without requires-python, pip may consider the wheel installable on unsupported interpreters (and the classifiers here now say “Python :: 3 :: Only”). Add an explicit requires-python matching the intended support range to keep packaging metadata consistent and prevent accidental installs on incompatible Python versions.

Copilot uses AI. Check for mistakes.
]
requires-python = ">=3.8"
keywords = ["azure", "azure sdk"]
dependencies = []
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

The legacy azure meta-package previously raised a RuntimeError on install (only allowing sdist builds), which prevented users from accidentally installing a deprecated/empty package. With setup.py removed, this pyproject.toml will allow building/installing the distribution normally, changing that long-standing behavior and likely reintroducing user confusion. Consider preserving the install-time failure behavior (or another explicit guard) so pip install azure still fails with the deprecation guidance message.

Suggested change
dependencies = []
dependencies = ["azure-core<0"]

Copilot uses AI. Check for mistakes.
@l0lawrence
Copy link
Member

@copilot lets remove our core/azure changes

Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 4, 2026

@copilot lets remove our core/azure changes

Done — reverted the sdk/core/azure changes in commit 88374ec. The setup.py is restored and pyproject.toml is back to its original state for that package.

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.

5 participants