fix(python): update extension checkout imports#119
Closed
ShuoRen-TT wants to merge 2 commits into
Closed
Conversation
ShuoRen-TT
marked this pull request as ready for review
July 7, 2026 17:42
Contributor
Author
|
Hi maintainers, this PR is ready for review. It fixes #118 by updating the Python sample server to import the generated extension Checkout models from the current SDK namespace. This should also unblock the conformance CI failure currently seen in Universal-Commerce-Protocol/conformance#47. Local validation is listed in the PR body, including server import, ruff, py_compile, and a real Flower Shop server startup check. |
Contributor
|
Thanks for flagging this. We fixed the Python SDK in Universal-Commerce-Protocol/python-sdk#29 - the server should be able to start now, please verify and feel free to reopen if that still doesn't work. Thanks again! |
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
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
Fixes #118.
The Python Flower Shop server now imports composed extension
Checkoutmodels from the SDK's generated namespace paths underdev.ucp.shopping, matching the current python-sdk output after Universal-Commerce-Protocol/python-sdk#48.What changed
Checkoutimports inrest/python/server/models.py.rest/python/server/integration_test.py.server_import_test.pyto smoke-test importingserver.pywith the current SDK models.Why
Current samples main imports
Checkoutfrom top-level extension packages such asucp_sdk.models.schemas.shopping.ap2_mandate. After python-sdk#48, those top-level modules no longer export the composedCheckout; the classes live under...dev.ucp.shopping. Fresh setup following the README therefore fails before the server starts.Validation
ImportErrorbefore the change.uv run --directory rest/python/server python - <<'PY' ... import server ... PYuv run --directory rest/python/server pytest server_import_test.pyuv run --directory rest/python/server ruff format --check models.py integration_test.py server_import_test.pyuv run --directory rest/python/server ruff check models.py integration_test.py server_import_test.pyuv run --directory rest/python/server python -m py_compile models.py integration_test.py server_import_test.py server.pyGET /.well-known/ucpreturns 200 on port 8183.ruff,ruff-format,trailing-whitespace,end-of-file-fixer,check-added-large-files,detect-private-key,codespell.Note: full
uvx pre-commit run --files ...could not complete because the Prettier hook failed while installing npm dependencytiny-levenshtein@^1.1.0, unrelated to these Python files.