-
Notifications
You must be signed in to change notification settings - Fork 316
[http-client-python] Preserve custom fields when migrating from setup.py to pyproject.toml #8673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
14
commits into
main
Choose a base branch
from
copilot/fix-693fde59-8e8e-4f46-ac31-090e6f2731c7
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Move setup.py removal to after package file serialization - Read both pyproject.toml and setup.py during migration - Add _keep_setuppy_fields() method to parse setup.py - Merge fields from setup.py into pyproject.toml - Update templates for keywords, project.urls - Update README.md reference from setup.py to pyproject.toml Co-authored-by: swathipil <[email protected]>
- Created test_setup_migration.py with comprehensive tests - Tests cover dependencies, keywords, URLs extraction - All tests passing successfully Co-authored-by: swathipil <[email protected]>
Copilot finished work on behalf of
swathipil
October 6, 2025 22:28
swathipil
reviewed
Oct 6, 2025
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Outdated
Show resolved
Hide resolved
...tp-client-python/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Show resolved
Hide resolved
packages/http-client-python/generator/test/unittests/test_setup_migration.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/test/unittests/test_setup_migration.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/test/unittests/test_setup_migration.py
Show resolved
Hide resolved
packages/http-client-python/generator/test/unittests/test_setup_migration.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/test/unittests/test_setup_migration.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/test/unittests/test_setup_migration.py
Outdated
Show resolved
Hide resolved
- Change _keep_pyproject_fields and _keep_setuppy_fields to mutate params - Initialize params with default keywords {"azure", "azure sdk"} - Update _keep_setuppy_fields to parse project_urls instead of url - Log actual dependency version in INFO messages - Remove duplicate keyword filtering (now handled by set) - Update pyproject.toml template to always output keywords from KEEP_FIELDS - Rewrite tests to use caplog for logging verification - Add test for PACKAGE_PPRINT_NAME warning - Add test for isodate version update to 100.0.0 - Update test to check project_urls parsing - Remove test for url field - All tests passing Co-authored-by: swathipil <[email protected]>
Copilot finished work on behalf of
swathipil
October 6, 2025 23:20
swathipil
reviewed
Oct 6, 2025
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Outdated
Show resolved
Hide resolved
...tp-client-python/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2
Show resolved
Hide resolved
...tp-client-python/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2
Show resolved
Hide resolved
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/test/unittests/test_setup_migration.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/test/unittests/test_setup_migration.py
Outdated
Show resolved
Hide resolved
- Move logger import to top of file - Keep all URLs including Azure SDK URLs - Add quotes around multi-word keys in project.urls - Fix template to have single project.urls section - Update test to use Azure SDK URLs - Update test comment Co-authored-by: swathipil <[email protected]>
Copilot finished work on behalf of
swathipil
October 6, 2025 23:53
All changed packages have been documented.
Show changes
|
The logging format was changed in c3ccdbd to log the full dependency string instead of just the name and version. Updated test assertion to match. Co-authored-by: swathipil <[email protected]>
Copilot finished work on behalf of
swathipil
October 7, 2025 00:03
swathipil
reviewed
Oct 7, 2025
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/test/unittests/test_setup_migration.py
Outdated
Show resolved
Hide resolved
Preserve custom fields during migration from setup.py to pyproject.toml for the http-client-python package.
- Add project.urls preservation from existing pyproject.toml - Simplify multi-word key formatting to single line - Update test to definitively check for quoted multi-word keys Co-authored-by: swathipil <[email protected]>
Copilot finished work on behalf of
swathipil
October 7, 2025 00:08
swathipil
reviewed
Oct 7, 2025
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/pygen/codegen/serializers/general_serializer.py
Outdated
Show resolved
Hide resolved
…uotes - Add default Azure SDK repository URL to KEEP_FIELDS for Azure flavor packages - Remove separate repository line from template (now unified with custom URLs) - Update regex comment to clarify it handles both single and double quotes - All URLs now rendered from KEEP_FIELDS consistently Co-authored-by: swathipil <[email protected]>
Copilot finished work on behalf of
swathipil
October 7, 2025 00:31
swathipil
reviewed
Oct 7, 2025
params["KEEP_FIELDS"]["project.keywords"].update(existing_keywords) | ||
|
||
# Keep project URLs | ||
if "urls" in loaded_pyproject_toml["project"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test in autorest.python PR to check additional project.urls are kept
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Successfully implemented automatic migration of fields from setup.py to pyproject.toml when generating Python SDKs.
Changes Completed
_keep_setuppy_fields()
method to parse setup.py fieldsserialize_package_file()
to accept setup.py contentLatest Changes
Fields Migrated from setup.py
✅ Dependencies - Custom dependencies preserved, tracked deps with higher versions update VERSION_MAP
⚠️ PACKAGE_PPRINT_NAME - Warning logged if mismatched
✅ Keywords - All keywords kept as a set (no duplicates)
✅ Project URLs - All URLs preserved with proper TOML formatting (from both setup.py and pyproject.toml)
Testing
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.