Skip to content

build(test-flask): Migrate to uv and pyproject.toml#26

Merged
ericapisani merged 1 commit into
mainfrom
PY-2453-test-flask
May 21, 2026
Merged

build(test-flask): Migrate to uv and pyproject.toml#26
ericapisani merged 1 commit into
mainfrom
PY-2453-test-flask

Conversation

@ericapisani

Copy link
Copy Markdown
Member

Summary

  • 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
  • Remove legacy requirements.txt

Refs PY-2453

Test plan

  • Verify pyproject.toml includes all dependencies from the original requirements.txt
  • Verify run.sh uses uv run
  • Verify requirements.txt is removed

🤖 Generated with Claude Code

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>
@linear-code

linear-code Bot commented May 21, 2026

Copy link
Copy Markdown

PY-2453

Comment thread test-flask/run.sh
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ericapisani ericapisani merged commit 82f0d3b into main May 21, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant