Skip to content

Commit 34a2004

Browse files
ericapisaniclaude
andauthored
build(test-django-cache-module): Migrate to uv and pyproject.toml (#14)
Replace pip/requirements.txt with uv/pyproject.toml for dependency management. Update run-django.sh and run-locust.sh to use uv run instead of manual venv creation and pip install. Fixes PY-2441 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 360d296 commit 34a2004

4 files changed

Lines changed: 31 additions & 40 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[project]
2+
name = "test-django-cache-module"
3+
version = "0"
4+
requires-python = ">=3.12"
5+
6+
dependencies = [
7+
"django>=5.2",
8+
"gunicorn>=23.0.0",
9+
"ipdb>=0.13.13",
10+
"locust>=2.32.4",
11+
"matplotlib>=3.10.1",
12+
"memcache>=1.4.1",
13+
"memory-profiler>=0.61.0",
14+
"psycopg>=3.2.6",
15+
"pymemcache>=4.0.0",
16+
"redis>=5.2.1",
17+
"sentry-sdk[django]",
18+
]
19+
20+
[tool.uv.sources]
21+
sentry-sdk = { path = "../../sentry-python", editable = true }

test-django-cache-module/requirements.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

3-
# exit on first error
4-
set -xe
5-
6-
# create and activate virtual environment
7-
python -m venv .venv
8-
source .venv/bin/activate
9-
10-
# Install (or update) requirements
11-
python -m pip install -r requirements.txt
4+
if ! command -v uv &> /dev/null; then
5+
curl -LsSf https://astral.sh/uv/install.sh | sh
6+
fi
127

138
pkill redis-server || true
149
sleep 1
1510
rm -rf dump.rdb
1611
redis-server --daemonize yes
1712

18-
# run migrations
19-
# cd mysite && ./manage.py migrate && cd ..
20-
21-
# Run Django application on localhost:8000 (DEBUG)
22-
# cd mysite && ./manage.py runserver 0.0.0.0:8000 && cd ..
23-
24-
# Run Django application on localhost:8000 (PRODUCTION)
25-
cd mysite && mprof run --multiprocess --output "../mprofile_$(date +%Y%m%d%H%M%S).dat" gunicorn wsgi && cd ..
26-
# cd mysite && gunicorn --log-level 'debug' wsgi && cd ..
13+
cd mysite && uv run mprof run --multiprocess --output "../mprofile_$(date +%Y%m%d%H%M%S).dat" gunicorn wsgi && cd ..
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

3-
# exit on first error
4-
set -xe
4+
if ! command -v uv &> /dev/null; then
5+
curl -LsSf https://astral.sh/uv/install.sh | sh
6+
fi
57

6-
# create and activate virtual environment
7-
python -m venv .venv
8-
source .venv/bin/activate
9-
10-
locust
8+
uv run locust

0 commit comments

Comments
 (0)