refactor: mv py qs from pip -> uv#1316
Open
sicoyle wants to merge 1 commit into
Open
Conversation
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the Python quickstarts/tutorials from pip install -r requirements.txt to uv using pyproject.toml, uv.lock, and .python-version, and updates docs/templates/CI so dapr run can execute apps via uv run without manual venv activation.
Changes:
- Replace per-app
requirements.txtinstalls withuv syncand addpyproject.toml(+ lockfiles and.python-version) across Python samples. - Update
dapr.yaml/multi-app templates and README run commands to invoke apps viauv run. - Update GitHub Actions validation workflows to install/use
uvand installmechanical-markdownviauv tool.
Reviewed changes
Copilot reviewed 105 out of 125 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| workflows/python/sdk/README.md | Switches install/run instructions to uv sync / uv run. |
| workflows/python/sdk/pyproject.toml | Adds uv project metadata and dependencies for the workflows SDK quickstart. |
| workflows/python/sdk/order-processor/requirements.txt | Removes legacy pip requirements file. |
| workflows/python/sdk/dapr.yaml | Runs the app through uv run. |
| workflows/python/sdk/.python-version | Pins Python 3.11. |
| tutorials/pub-sub/README.md | Updates Python subscriber steps to use uv. |
| tutorials/pub-sub/python-subscriber/uv.lock | Adds uv lockfile for reproducible installs. |
| tutorials/pub-sub/python-subscriber/requirements.txt | Removes legacy pip requirements file. |
| tutorials/pub-sub/python-subscriber/pyproject.toml | Adds uv project metadata/dependencies for the Python subscriber. |
| tutorials/pub-sub/python-subscriber/.python-version | Pins Python 3.11. |
| tutorials/hello-world/README.md | Updates Python tutorial steps to use uv. |
| tutorials/hello-world/python/uv.lock | Adds uv lockfile for reproducible installs. |
| tutorials/hello-world/python/requirements.txt | Removes legacy pip requirements file. |
| tutorials/hello-world/python/pyproject.toml | Adds uv project metadata/dependencies for the hello-world Python app. |
| tutorials/hello-world/python/.python-version | Pins Python 3.11. |
| tutorials/distributed-calculator/README.md | Updates Python multiply-service steps to use uv. |
| tutorials/distributed-calculator/python/pyproject.toml | Adds uv project metadata/dependencies for the calculator Python service. |
| tutorials/distributed-calculator/python/.python-version | Pins Python 3.11. |
| tutorials/bindings/README.md | Updates Python bindings tutorial steps to use uv. |
| tutorials/bindings/pythonapp/pyproject.toml | Adds uv project metadata/dependencies for the Python bindings app. |
| tutorials/bindings/pythonapp/.python-version | Pins Python 3.11. |
| state_management/python/sdk/README.md | Switches install/run instructions to uv for the SDK variant. |
| state_management/python/sdk/pyproject.toml | Adds uv project metadata/dependencies for state management (SDK). |
| state_management/python/sdk/order-processor/requirements.txt | Removes legacy pip requirements file. |
| state_management/python/sdk/dapr.yaml | Runs the app through uv run. |
| state_management/python/sdk/.python-version | Pins Python 3.11. |
| state_management/python/http/README.md | Switches install/run instructions to uv for the HTTP variant. |
| state_management/python/http/pyproject.toml | Adds uv project metadata/dependencies for state management (HTTP). |
| state_management/python/http/order-processor/requirements.txt | Removes legacy pip requirements file. |
| state_management/python/http/dapr.yaml | Runs the app through uv run. |
| state_management/python/http/.python-version | Pins Python 3.11. |
| service_invocation/python/http/README.md | Switches install/run instructions to uv and workspace sync. |
| service_invocation/python/http/pyproject.toml | Defines uv workspace members for multi-package quickstart. |
| service_invocation/python/http/order-processor/requirements.txt | Removes legacy pip requirements file. |
| service_invocation/python/http/order-processor/pyproject.toml | Adds uv project metadata/dependencies for order-processor. |
| service_invocation/python/http/dapr.yaml | Runs both apps through uv run. |
| service_invocation/python/http/checkout/requirements.txt | Removes legacy pip requirements file. |
| service_invocation/python/http/checkout/pyproject.toml | Adds uv project metadata/dependencies for checkout. |
| service_invocation/python/http/.python-version | Pins Python 3.11. |
| secrets_management/python/sdk/README.md | Switches install/run instructions to uv for the SDK variant. |
| secrets_management/python/sdk/pyproject.toml | Adds uv project metadata/dependencies for secrets management (SDK). |
| secrets_management/python/sdk/order-processor/requirements.txt | Removes legacy pip requirements file. |
| secrets_management/python/sdk/.python-version | Pins Python 3.11. |
| secrets_management/python/http/uv.lock | Adds uv lockfile for reproducible installs. |
| secrets_management/python/http/README.md | Switches install/run instructions to uv for the HTTP variant. |
| secrets_management/python/http/pyproject.toml | Adds uv project metadata/dependencies for secrets management (HTTP). |
| secrets_management/python/http/order-processor/requirements.txt | Removes legacy pip requirements file. |
| secrets_management/python/http/.python-version | Pins Python 3.11. |
| resiliency/service-to-service-resiliency.md | Updates referenced Python commands to run via uv. |
| resiliency/service-to-component-resiliency.md | Updates referenced Python commands to run via uv. |
| pub_sub/python/sdk/README.md | Switches install/run instructions to uv and workspace sync. |
| pub_sub/python/sdk/pyproject.toml | Defines uv workspace members for multi-package quickstart. |
| pub_sub/python/sdk/order-processor/requirements.txt | Removes legacy pip requirements file. |
| pub_sub/python/sdk/order-processor/pyproject.toml | Adds uv project metadata/dependencies for SDK subscriber. |
| pub_sub/python/sdk/order-processor-fastapi/requirements.txt | Removes legacy pip requirements file. |
| pub_sub/python/sdk/order-processor-fastapi/pyproject.toml | Adds uv project metadata/dependencies for FastAPI variant. |
| pub_sub/python/sdk/dapr.yaml | Runs apps through uv run. |
| pub_sub/python/sdk/checkout/requirements.txt | Removes legacy pip requirements file. |
| pub_sub/python/sdk/checkout/pyproject.toml | Adds uv project metadata/dependencies for SDK publisher. |
| pub_sub/python/sdk/.python-version | Pins Python 3.11. |
| pub_sub/python/http/README.md | Switches install/run instructions to uv and workspace sync. |
| pub_sub/python/http/pyproject.toml | Defines uv workspace members for multi-package quickstart. |
| pub_sub/python/http/order-processor/requirements.txt | Removes legacy pip requirements file. |
| pub_sub/python/http/order-processor/pyproject.toml | Adds uv project metadata/dependencies for HTTP subscriber. |
| pub_sub/python/http/dapr.yaml | Runs apps through uv run (including uvicorn). |
| pub_sub/python/http/checkout/requirements.txt | Removes legacy pip requirements file. |
| pub_sub/python/http/checkout/pyproject.toml | Adds uv project metadata/dependencies for HTTP publisher. |
| pub_sub/python/http/.python-version | Pins Python 3.11. |
| jobs/python/http/uv.lock | Adds uv lockfile for reproducible installs. |
| jobs/python/http/requirements.txt | Removes legacy pip requirements file. |
| jobs/python/http/README.md | Switches install/run instructions to uv. |
| jobs/python/http/pyproject.toml | Adds uv project metadata/dependencies for jobs quickstart. |
| jobs/python/http/dapr.yaml | Runs both apps through uv run. |
| jobs/python/http/.python-version | Pins Python 3.11. |
| cryptography/python/sdk/README.md | Switches install/run instructions to uv. |
| cryptography/python/sdk/pyproject.toml | Adds uv project metadata/dependencies for cryptography quickstart. |
| cryptography/python/sdk/crypto-quickstart/requirements.txt | Removes legacy pip requirements file. |
| cryptography/python/sdk/.python-version | Pins Python 3.11. |
| conversation/python/sdk/README.md | Refactors setup/run instructions to uv. |
| conversation/python/sdk/pyproject.toml | Adds uv project metadata/dependencies for conversation SDK quickstart. |
| conversation/python/sdk/dapr.yaml | Runs the app through uv run. |
| conversation/python/sdk/dapr-tool-calling.yaml | Runs tool-calling app through uv run. |
| conversation/python/sdk/conversation/requirements.txt | Removes legacy pip requirements file. |
| conversation/python/sdk/.python-version | Pins Python 3.11. |
| conversation/python/http/uv.lock | Adds uv lockfile for reproducible installs. |
| conversation/python/http/README.md | Refactors setup/run instructions to uv. |
| conversation/python/http/pyproject.toml | Adds uv project metadata/dependencies for conversation HTTP quickstart. |
| conversation/python/http/dapr.yaml | Runs the app through uv run. |
| conversation/python/http/conversation/requirements.txt | Removes legacy pip requirements file. |
| conversation/python/http/.python-version | Pins Python 3.11. |
| configuration/python/sdk/README.md | Switches install/run instructions to uv for the SDK variant. |
| configuration/python/sdk/pyproject.toml | Adds uv project metadata/dependencies for configuration (SDK). |
| configuration/python/sdk/order-processor/requirements.txt | Removes legacy pip requirements file. |
| configuration/python/sdk/.python-version | Pins Python 3.11. |
| configuration/python/http/README.md | Switches install/run instructions to uv for the HTTP variant. |
| configuration/python/http/pyproject.toml | Adds uv project metadata/dependencies for configuration (HTTP). |
| configuration/python/http/order-processor/requirements.txt | Removes legacy pip requirements file. |
| configuration/python/http/.python-version | Pins Python 3.11. |
| bindings/python/sdk/README.md | Switches install/run instructions to uv. |
| bindings/python/sdk/pyproject.toml | Adds uv project metadata/dependencies for bindings (SDK). |
| bindings/python/sdk/dapr.yaml | Runs the app through uv run. |
| bindings/python/sdk/batch/requirements.txt | Removes legacy pip requirements file. |
| bindings/python/sdk/.python-version | Pins Python 3.11. |
| bindings/python/http/README.md | Switches install/run instructions to uv. |
| bindings/python/http/pyproject.toml | Adds uv project metadata/dependencies for bindings (HTTP). |
| bindings/python/http/dapr.yaml | Runs the app through uv run. |
| bindings/python/http/batch/requirements.txt | Removes legacy pip requirements file. |
| bindings/python/http/.python-version | Pins Python 3.11. |
| .github/workflows/validate_tutorials.yaml | Installs uv and uses uv tool install mechanical-markdown. |
| .github/workflows/validate_python_quickstarts.yaml | Installs uv and uses uv sync prior to running validations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
23
to
27
| --> | ||
|
|
||
| ```sh | ||
| cd ./order-processor | ||
| pip3 install -r requirements.txt | ||
| cd .. | ||
| uv sync | ||
| ``` |
Comment on lines
344
to
348
| 1. Install dependencies: | ||
|
|
||
| ```bash | ||
| pip3 install requests | ||
| uv sync | ||
| ``` |
Comment on lines
21
to
+26
| <!-- STEP | ||
| name: Install Node dependencies for order-processor and checkout | ||
| --> | ||
|
|
||
| ```bash | ||
| cd ./order-processor | ||
| pip3 install -r requirements.txt | ||
| cd ../checkout | ||
| pip3 install -r requirements.txt | ||
| cd .. | ||
| uv sync --all-packages |
Comment on lines
+100
to
105
| Expected output: | ||
|
|
||
| ```text | ||
| Input sent: calculate square root of 15 | ||
| Output response: ConversationResultAlpha2Choices(finish_reason='tool_calls', index=0, message=ConversationResultAlpha2Message(content='calculate square root of 15', tool_calls=[ConversationToolCalls(id='0', function=ConversationToolCallsOfFunction(name='calculate', arguments='expression'))])) | ||
| Input sent: get weather in San Francisco in celsius | ||
| Output response: ConversationResultAlpha2Choices(finish_reason='tool_calls', index=0, message=ConversationResultAlpha2Message(content='get weather in San Francisco in celsius', tool_calls=[ConversationToolCalls(id='0', function=ConversationToolCallsOfFunction(name='get_weather', arguments='location,unit'))])) | ||
| Output response: ConversationResultAlpha2Choices(finish_reason='tool_calls', index=0, message=ConversationResultAlpha2Message(content='calculate square root of 15', tool_calls=[ConversationToolCalls(id='0', function=ConversationToolCallsOfFunction(name='get_weather', arguments='location,unit'))])) | ||
| ``` |
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.
Description
NOTE: This can be post 1.18 if we want.
Migrates every Python quickstart (sdk + http) from
pip3 install -r requirements.txtto uv withpyproject.toml+uv.lock. Each quickstart pins Python via.python-version(3.11). Dapr'sdapr runnow invokes apps throughuv run, so contributors don't need to manually activate a venv beforedapr run -f ..Issue reference
We strive to have all PRs being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: