build(test-flask): Migrate to uv and pyproject.toml#26
Merged
Conversation
Replace pip/requirements.txt with uv/pyproject.toml for dependency management. Update run.sh to use uv run instead of manual venv creation and pip install. Refs PY-2453 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment on lines
+4
to
+8
| 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 | ||
|
|
||
| # Initialize database | ||
| # flask --app flaskr init-db | ||
|
|
||
| # Run Flask application on localhost:5000 | ||
| flask --app flaskr run No newline at end of file | ||
| uv run flask --app flaskr run |
There was a problem hiding this comment.
Bug: The script installs uv but doesn't update the current shell's $PATH, causing the subsequent uv run command to fail with 'command not found' in clean environments.
Severity: HIGH
Suggested Fix
After the curl | sh installation line, add export PATH="$HOME/.local/bin:$PATH" to update the current shell's PATH variable. This ensures the uv command is found and executed correctly within the same script session. Alternatively, source the profile file, e.g., source "$HOME/.cargo/env", if the installer provides a consistent environment file.
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-flask/run.sh#L4-L8
Potential issue: When `uv` is not pre-installed, the script attempts to install it using
`curl -LsSf https://astral.sh/uv/install.sh | sh`. However, this installer only modifies
shell profile files (e.g., `.bashrc`) and does not update the `$PATH` of the current,
non-interactive shell session. As a result, the immediately following `uv run` command
on line 8 fails because the `uv` executable cannot be found. Since `set -euo pipefail`
is active, the script exits immediately upon this failure, preventing the test from
running in any environment without a pre-existing `uv` installation, such as a clean CI
runner.
Did we get this right? 👍 / 👎 to inform future reviews.
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
pip/requirements.txtwithuv/pyproject.tomlfor dependency managementrun.shto useuv runinstead of manual venv creation and pip installrequirements.txtRefs PY-2453
Test plan
pyproject.tomlincludes all dependencies from the originalrequirements.txtrun.shusesuv runrequirements.txtis removed🤖 Generated with Claude Code