Migrate first 10 alphabetical SDK packages from setup.py to pyproject.toml#45519
Migrate first 10 alphabetical SDK packages from setup.py to pyproject.toml#45519
Conversation
…d of setup.py Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com>
There was a problem hiding this comment.
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.pyfrom six packages and moved build/metadata configuration intopyproject.toml. - Added
build-systemandprojectmetadata sections (including dynamic version/readme where applicable). - Introduced a new
pyproject.tomlfor theazure-agrifood-nspkgnamespace 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. |
| [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", | ||
| ] |
There was a problem hiding this comment.
[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.
sdk/core/azure/pyproject.toml
Outdated
| ] | ||
| requires-python = ">=3.8" | ||
| keywords = ["azure", "azure sdk"] | ||
| dependencies = [] |
There was a problem hiding this comment.
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.
| dependencies = [] | |
| dependencies = ["azure-core<0"] |
|
@copilot lets remove our core/azure changes |
Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com>
Converts the first 10 packages alphabetically in the SDK repo to use
pyproject.tomlas the build system, removingsetup.pywhere applicable.Packages migrated (5 of 10 needed changes)
azure-agrifood-farmingsdk/agrifood/azure-agrifood-farmingazure-agrifood-nspkgsdk/nspkg/azure-agrifood-nspkgazure-ai-agentssdk/ai/azure-ai-agentsazure-ai-anomalydetectorsdk/anomalydetector/azure-ai-anomalydetectorazure-ai-contentsafetysdk/contentsafety/azure-ai-contentsafetyThe remaining 5 were skipped:
azure-ai-agentserver-{agentframework,core,langgraph}andazure-ai-contentunderstandingwere alreadypyproject.toml-only, andazure(sdk/core/azure) is excluded as it has special install-time behavior that requires retainingsetup.py.What changed per package
[build-system],[project],[tool.setuptools.dynamic],[tool.setuptools.packages.find], and[tool.setuptools.package-data]sections to eachpyproject.toml[tool.azure-sdk-build],[tool.azure-sdk-conda],[tool.mypy],[tool.isort], etc.)setup.pyazure-agrifood-nspkg(namespace package with no priorpyproject.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.pyattr andREADME.md/CHANGELOG.mdfiles.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.