Skip to content

Commit 3c58148

Browse files
migrate to uv and 3.13 (closes #82)
1 parent 979f87f commit 3c58148

8 files changed

Lines changed: 1745 additions & 1984 deletions

File tree

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
FROM python:3.12.3-slim
1+
FROM python:3.13.5-slim-bookworm
2+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
23

34
ENV PYTHONDONTWRITEBYTECODE 1
45
ENV PYTHONUNBUFFERED 1
56

67
WORKDIR /code
78

89
# Install dependencies
9-
COPY Pipfile Pipfile.lock ./
10-
RUN pip install pipenv && pipenv install --system
10+
COPY "pyproject.toml" "uv.lock" ".python-version" ./
11+
RUN uv sync --locked
12+
ENV PATH="/code/.venv/bin:$PATH"
1113

1214
# Copy project
1315
COPY . .

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,47 @@ SITE_ID ?= 2
66

77
run: ## Run django server
88
run:
9-
pipenv run python manage.py runserver 0.0.0.0:8000
9+
uv run python manage.py runserver 0.0.0.0:8000
1010

1111

1212
migrations: ## Make migrations
1313
migrations:
14-
pipenv run python manage.py makemigrations
15-
pipenv run python manage.py migrate
14+
uv run python manage.py makemigrations
15+
uv run python manage.py migrate
1616

1717

1818
admin: ## Add an admin user
1919
admin:
20-
pipenv run python manage.py createsuperuser
20+
uv run python manage.py createsuperuser
2121

2222

2323
user:
24-
pipenv run python add_user.py
24+
uv run python add_user.py
2525

2626

2727
tests: ## Run tests
2828
tests:
29-
pipenv run python manage.py test courses.tests
29+
uv run python manage.py test courses.tests
3030

3131

3232
data: ## Add data to database
3333
data: migrations
34-
pipenv run python add_data.py
34+
uv run python add_data.py
3535

3636
test_data: data
37-
pipenv run python add_more_test_data.py
37+
uv run python add_more_test_data.py
3838

3939
shell: ## Run django shell
4040
shell:
41-
pipenv run python manage.py shell
41+
uv run python manage.py shell
4242

4343

4444
tunnel_prod: ## Open tunnel to prod
4545
bash tunnel-prod.sh
4646

4747
notebook: ## Run a jupyter notebook
4848
notebook:
49-
pipenv run jupyter notebook
49+
uv run jupyter notebook
5050

5151

5252
docker_build: ## Build docker image

Pipfile

Lines changed: 0 additions & 29 deletions
This file was deleted.

Pipfile.lock

Lines changed: 0 additions & 1927 deletions
This file was deleted.

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ peer reviews.
88
Students can enroll in courses, submit homework, projects
99
and engage in peer evaluations.
1010

11-
1211
## Features
1312

1413
- **User Authentication**: Registration and login functionality for students and instructors.
@@ -31,22 +30,19 @@ and engage in peer evaluations.
3130

3231
### Installing dependencies
3332

34-
Install pipenv if you don't have it yet:
33+
This project uses uv for dependency management and requires Python 3.13.
3534

36-
```bash
37-
pip install pipenv
38-
```
39-
40-
Install the dependencies (you need Python 3.9):
35+
Install uv if you don't have it yet:
4136

4237
```bash
43-
pipenv install
38+
pip install uv
4439
```
4540

46-
Activate virtual env:
41+
Install Python 3.13 and dependencies:
4742

4843
```bash
49-
pipenv shell
44+
uv python install 3.13
45+
uv sync --dev
5046
```
5147

5248
### Prepare the service
@@ -61,14 +57,14 @@ Make migrations:
6157

6258
```bash
6359
make migrations
64-
# python manage.py migrate
60+
# uv run python manage.py migrate
6561
```
6662

6763
Add an admin user:
6864

6965
```bash
7066
make admin
71-
# python manage.py createsuperuser
67+
# uv run python manage.py createsuperuser
7268
```
7369

7470
Add some data:
@@ -81,7 +77,7 @@ make data
8177

8278
```bash
8379
make run
84-
# python manage.py runserver 0.0.0.0:8000
80+
# uv run python manage.py runserver 0.0.0.0:8000
8581
```
8682

8783
## Running with Docker
@@ -107,9 +103,10 @@ if you're on cygwin:
107103

108104
```bash
109105
docker run -it --rm \
110-
-p 8000:8000 \
106+
-p 8000:80 \
111107
--name course_management \
112108
-e DATABASE_URL="sqlite:////data/db.sqlite3" \
109+
-e SITE_ID="${SITE_ID}" \
113110
-v `cygpath -w ${PWD}/db`:/data \
114111
course_management
115112
```

pyproject.toml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
[project]
2+
name = "course-management-platform"
3+
version = "0.1.0"
4+
description = "A Django-based course management platform"
5+
requires-python = ">=3.13"
6+
7+
dependencies = [
8+
"django",
9+
"django-allauth[slack]",
10+
"requests",
11+
"pyjwt",
12+
"cryptography",
13+
"dj-database-url",
14+
"whitenoise",
15+
"psycopg2-binary",
16+
"gunicorn",
17+
"python-json-logger",
18+
"django-unfold",
19+
"django-loginas",
20+
]
21+
22+
[project.optional-dependencies]
23+
dev = [
24+
"ipython",
25+
"pytest-django",
26+
"jupyter",
27+
"pandas",
28+
"tqdm",
29+
]
30+
31+
132
[tool.ruff]
233
line-length = 72
334

@@ -7,4 +38,4 @@ python_files = ["test_*.py"]
738

839
testpaths = [
940
"courses/tests"
10-
]
41+
]

0 commit comments

Comments
 (0)