Skip to content

Port all packages from setup.py to pyproject.toml#45336

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/port-packages-to-pyproject
Draft

Port all packages from setup.py to pyproject.toml#45336
Copilot wants to merge 3 commits intomainfrom
copilot/port-packages-to-pyproject

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

Migrates 279 SDK packages from setup.py to PEP 621 pyproject.toml format, removing setup.py and sdk_packaging.toml files across the SDK. Also cleans up 23 orphaned sdk_packaging.toml files from packages already using pyproject.toml.

Migration script

eng/scripts/migrate_setup_py_to_pyproject.py — new standalone migration tool:

  • Parses setup.py via AST + execution to extract all metadata
  • Creates/updates pyproject.toml with [build-system], [project], [project.urls], [tool.setuptools.*] sections
  • Merges existing [packaging] from sdk_packaging.toml and preserves existing [tool.*] settings (mypy, isort, azure-sdk-build, etc.)
  • Deduplicates find_packages(exclude=[...]) entries
  • Skips: namespace packages (nspkg), deprecated meta-packages, C-extension packages, test packages
  • Supports --dry-run, --keep-setup-py, single package (--package-path) or all (--all)

Tooling updates

  • packaging_tools/templates/packaging_files/pyproject.toml — new Jinja2 template replacing setup.py for future package scaffolding
  • packaging_tools/__init__.pybuild_packaging_by_package_name now skips setup.py generation, removes existing setup.py, and merges into (rather than overwrites) existing pyproject.toml
  • packaging_tools/generate_utils.pygenerate_packaging_and_ci_files unconditionally deletes setup.py when pyproject.toml is present

Result

  • 382 packages now have pyproject.toml with a [project] section (all parse correctly via ParsedSetup.from_path())
  • Remaining setup.py files: nspkg packages (27), deprecated meta-packages (azure, azure-mgmt, azure-keyvault), and C-extension package (azure-storage-extensions)

Before:

# pyproject.toml — only tool settings, no build metadata
[tool.azure-sdk-build]
pyright = false
# setup.py — all packaging metadata lived here
setup(name="azure-data-tables", version=version, install_requires=[...], ...)

After:

# pyproject.toml — complete PEP 621 package definition
[build-system]
requires = ["setuptools>=77.0.3", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "azure-data-tables"
dependencies = ["azure-core>=1.29.4", "yarl>=1.0", ...]
dynamic = ["version", "readme"]

[tool.setuptools.dynamic.version]
attr = "azure.data.tables._version.VERSION"

[tool.azure-sdk-build]
pyright = false

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • ghcr.io
    • Triggering command: /tmp/dependabot-cli/dependabot/dependabot /tmp/dependabot-cli/dependabot/dependabot graph pip org/repo --local /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python --branch main --directory sdk/advisor/azure-mgmt-advisor --proxy-cert /home/REDACTED/work/_temp/runtime-logs/mkcert/rootCA.pem --updater-env NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/dbot-ca.crt /etc/ssl/certs/OISTE_WISeKey_Global_Root_GB_CA.pem /usr/bin/ln t.pem /var/run/docker//usr/bin/runc e ln (dns block)
    • Triggering command: /tmp/dependabot-cli/dependabot/dependabot /tmp/dependabot-cli/dependabot/dependabot graph pip org/repo --local /tmp/dependabot-base-Ae3K0M/repo --branch main --directory sdk/advisor/azure-mgmt-advisor --proxy-cert /home/REDACTED/work/_temp/runtime-logs/mkcert/rootCA.pem --updater-env NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/dbot-ca.crt /usr/share/ca-certificates/mozilla/OISTE_WISeKey_Global_Root_GB_CA.crt n/git-credential-store-immutable --file /home/dependabot/dependabot-updater/git.store t.pem /var/run/docker//usr/bin/runc /usr/bin/ln sed (dns block)
    • Triggering command: /tmp/dependabot-cli/dependabot/dependabot /tmp/dependabot-cli/dependabot/dependabot graph pip org/repo --local /tmp/dependabot-base-Ae3K0M/repo --branch main --directory sdk/agrifood/azure-agrifood-farming --proxy-cert /home/REDACTED/work/_temp/runtime-logs/mkcert/rootCA.pem --updater-env NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/dbot-ca.crt sed /usr/local/.pyenv/bin/test crt /usr/share/ca-ce-q test test (dns block)
  • pypi.org
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.9/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-96eurjhp/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=42 wheel k/azure-sdk-for---norc k/azure-sdk-for---noprofile k/azure-sdk-for-python/azure-sdk/home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/sdk/networkfunction/azure-mgmt-networkfunction/pyproject.toml (dns block)
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/pip pip install /tmp/test_migration/azure-data-tables/dist/azure_data_tables-12.8.0b1-py3-none-any.whl --quiet --no�� --noprofile python/azure-sdk-for-python/sdk/nspkg/azure-cognitiveservices-search-nspkg/pyproject.toml v/bin/bash tils.py age_properties.p--norc _checks.py stat k/az�� --format=%T python/azure-sdk-for-python/sdk/apimanagement/azure-mgmt-apimanagement/pyproject.toml rvices/setup.py uild.py .py lled_packages.py--noprofile bash (dns block)
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.9/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-ryo16vic/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=42 wheel python/azure-sdk--norc /setup.py grep (dns block)
  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 24, 2026 19:16
- Add migration script at eng/scripts/migrate_setup_py_to_pyproject.py
- Run migration on all 309 packages (279 migrated, 30 skipped)
- Update packaging_tools template to generate pyproject.toml instead of setup.py
- Update build_packaging_by_package_name to skip setup.py generation and remove existing setup.py files
- Update generate_packaging_and_ci_files to always delete setup.py when pyproject.toml exists

Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com>
…casing, merge remaining sdk_packaging.toml files

Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com>
Copilot AI changed the title [WIP] Port all packages from setup.py to pyproject.toml Port all packages from setup.py to pyproject.toml Feb 24, 2026
Copilot AI requested a review from l0lawrence February 24, 2026 19:27
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