build(test-grpc): Migrate to uv and pyproject.toml#29
Conversation
Replace pip/requirements.txt with uv/pyproject.toml for dependency management. Update all run scripts to use uv run instead of manual venv creation and pip install. Refs PY-2456 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| [project] | ||
| name = "test-grpc" | ||
| version = "0" | ||
| requires-python = ">=3.12" |
There was a problem hiding this comment.
Bug: The Python version in .python-version (3.10) conflicts with the requires-python constraint (>=3.12) in pyproject.toml, causing uv run to fail.
Severity: HIGH
Suggested Fix
Align the Python versions. Either update the .python-version file to a version compatible with the >=3.12 constraint, or adjust the requires-python setting in pyproject.toml to ">=3.10" if the code supports it.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: test-grpc/pyproject.toml#L4
Potential issue: The `test-grpc` directory contains a `.python-version` file that
specifies Python version `3.10`. However, the `pyproject.toml` file introduced in this
pull request requires Python version `>=3.12`. When scripts like `run-server.sh` are
executed using `uv run`, `uv` detects this version conflict and exits with an error,
preventing the scripts from running.
Did we get this right? 👍 / 👎 to inform future reviews.
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # exit on first error | ||
| set -xe | ||
| if ! command -v uv &> /dev/null; then | ||
| curl -LsSf https://astral.sh/uv/install.sh | sh | ||
| fi | ||
|
|
||
| # create and activate virtual environment | ||
| python -m venv .venv | ||
| source .venv/bin/activate | ||
|
|
||
| # Install (or update) requirements | ||
| python -m pip install -r requirements.txt | ||
|
|
||
|
|
||
| python server.py No newline at end of file | ||
| uv run python server.py |
There was a problem hiding this comment.
Bug: The compile-service.sh script was not updated to use uv and fails because it can no longer install its dependencies.
Severity: HIGH
Suggested Fix
Update compile-service.sh to use uv run for executing the protobuf compiler, similar to how run-server.sh was updated. This ensures the necessary dependencies, like grpcio-tools, are available during execution.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: test-grpc/run-server.sh#L1-L8
Potential issue: The `compile-service.sh` script was not updated to use `uv` for
dependency management. It still attempts to create a virtual environment and run `python
-m grpc_tools.protoc`. Since the `requirements.txt` file was removed and dependencies
are now managed by `uv` via `pyproject.toml`, the virtual environment created by the
script is empty. This causes the script to fail with a `No module named
grpc_tools.protoc` error, rendering it unusable.
Did we get this right? 👍 / 👎 to inform future reviews.
Summary
pip/requirements.txtwithuv/pyproject.tomlfor dependency managementuv runinstead of manual venv creation and pip installrequirements.txtRefs PY-2456
Test plan
pyproject.tomlincludes all dependencies from the originalrequirements.txtuv runrequirements.txtis removed🤖 Generated with Claude Code