Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions test-django-cache-module/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[project]
name = "test-django-cache-module"
version = "0"
requires-python = ">=3.12"

dependencies = [
"django>=5.2",
"gunicorn>=23.0.0",
"ipdb>=0.13.13",
"locust>=2.32.4",
"matplotlib>=3.10.1",
"memcache>=1.4.1",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unsatisfiable version constraint for memcache package

High Severity

The memcache package on PyPI only goes up to version 0.14.0, so the constraint memcache>=1.4.1 can never be satisfied and dependency resolution will fail. The version 1.4.1 appears to have been accidentally taken from the pymemcache package (listed on the next line), which does have that version. The original requirements.txt listed memcache without any version pin.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 64301c2. Configure here.

"memory-profiler>=0.61.0",
"psycopg>=3.2.6",
"pymemcache>=4.0.0",
"redis>=5.2.1",
"sentry-sdk[django]",
]

[tool.uv.sources]
sentry-sdk = { path = "../../sentry-python", editable = true }
15 changes: 0 additions & 15 deletions test-django-cache-module/requirements.txt

This file was deleted.

23 changes: 5 additions & 18 deletions test-django-cache-module/run-django.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail

# exit on first error
set -xe

# create and activate virtual environment
python -m venv .venv
source .venv/bin/activate

# Install (or update) requirements
python -m pip install -r requirements.txt
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi
Comment on lines +4 to +6

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. The subsequent uv run command will fail with "command not found", causing the script to exit.
Severity: HIGH

Suggested Fix

After the uv installation, update the current shell's PATH before calling uv. One way is to source the environment file modified by the installer, for example: source "$HOME/.cargo/env". Alternatively, you can explicitly add the binary's location to the PATH: export PATH="$HOME/.local/bin:$PATH".

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-django-cache-module/run-django.sh#L4-L6

Potential issue: After installing `uv` via `curl`, the installer modifies shell
configuration files but does not update the `PATH` for the current, non-interactive
shell session. Because the script has `set -euo pipefail` enabled, the subsequent call
to `uv run` fails with a "command not found" error, which immediately terminates the
script. This bug will manifest in any environment where `uv` is not already installed,
which is the exact condition the installation block is designed for. The same issue
exists in `run-locust.sh`.

Did we get this right? 👍 / 👎 to inform future reviews.


pkill redis-server || true
sleep 1
rm -rf dump.rdb
redis-server --daemonize yes

# run migrations
# cd mysite && ./manage.py migrate && cd ..

# Run Django application on localhost:8000 (DEBUG)
# cd mysite && ./manage.py runserver 0.0.0.0:8000 && cd ..

# Run Django application on localhost:8000 (PRODUCTION)
cd mysite && mprof run --multiprocess --output "../mprofile_$(date +%Y%m%d%H%M%S).dat" gunicorn wsgi && cd ..
# cd mysite && gunicorn --log-level 'debug' wsgi && cd ..
cd mysite && uv run mprof run --multiprocess --output "../mprofile_$(date +%Y%m%d%H%M%S).dat" gunicorn wsgi && cd ..
12 changes: 5 additions & 7 deletions test-django-cache-module/run-locust.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/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

locust
uv run locust
Loading