Skip to content

Commit 2db8a81

Browse files
authored
Merge pull request #1 from alflanagan/switch_to_uv
Switch to uv
2 parents c2a5bdd + afe7d61 commit 2db8a81

File tree

13 files changed

+1474
-1246
lines changed

13 files changed

+1474
-1246
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ secrets.txt
66
# directories w/files from old website
77
/components/
88
/public/
9-
10-
# auto-select for my local virtualenv
11-
.python-version

.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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ ENV PYTHONUNBUFFERED=1 \
2828
# Use /app folder as a directory where the source code is stored.
2929
WORKDIR /app
3030

31+
# requirements handled automatically by uv
3132
# Install the project requirements.
32-
COPY app/Makefile requirements.txt /app/
33-
RUN make pip-setup && pip-sync requirements.txt
33+
# COPY app/Makefile requirements.txt /app/
34+
# RUN make pip-setup && pip-sync requirements.txt
3435

3536
# Copy the source code of the project into the container.
3637
COPY app /app/
38+
39+
RUN pip install --no-cache-dir uv==0.7.12 && \
40+
uv sync --frozen

Makefile

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,17 @@ start:
1010

1111
#start a shell running in the django environment
1212
shell:
13-
docker exec -it alf-wag /bin/bash -i
13+
docker compose exec -it wagtail /bin/bash -i
1414

1515
rootshell:
16-
docker exec -it -u 0 alf-wag /bin/bash -i
16+
docker compose exec -it -u 0 wagtail /bin/bash -i
1717

1818
dbshell:
19-
docker exec -it alf-pg /bin/bash -i
20-
21-
requirements:
22-
$(PIP_COMPILE) requirements.in; $(PIP_COMPILE) requirements.dev.in
23-
24-
# this does not work, as of 7/7/2004
25-
# upgrade_reqts:
26-
# $(PIP_COMPILE) --upgrade requirements.in --upgrade requirements.dev.in --output-file requirements.txt
27-
28-
upgrade_reqts:
29-
$(PIP_COMPILE) --upgrade requirements.in; \
30-
$(PIP_COMPILE) --upgrade requirements.dev.in
31-
32-
pip-init:
33-
python -m pip install --upgrade pip wheel pip-tools
34-
35-
pip-sync:
36-
pip-sync requirements.txt requirements.dev.txt
19+
docker compose exec -it postgres /bin/bash -i
3720

3821
# this makes up for the fact that make has no command to show what tasks are defined
3922
# no attempt was made at a universal solution; you'll need to enhance for any but most basic case
4023
targets:
4124
@grep -E '^[a-zA-Z_-]+:' Makefile | cut -d: -f1 | grep -v targets
25+
26+
tasks: targets

app/Makefile

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
.PHONY: requirements pip-setup tasks stop start rootshell dbshell
2-
3-
PIP_COMPILE = pip-compile --generate-hashes --allow-unsafe --output-file
4-
5-
# run this once, when setting up a totally new environment
6-
pip-setup:
7-
python -m pip install --upgrade pip setuptools wheel pip-tools
8-
9-
# run this any time requirements.in or requirements.dev.in change
10-
requirements:
11-
$(PIP_COMPILE) requirements.txt requirements.in requirements.dev.in
12-
pip-sync requirements.txt
1+
PYTHON=uv run python
132

143
run-server:
15-
python manage.py migrate
16-
python manage.py runserver 0.0.0.0:8080
4+
$(PYTHON) manage.py migrate
5+
$(PYTHON) manage.py runserver 0.0.0.0:8080
176

187
djhtml:
198
find alloydflanagan -name '*.html' -exec djhtml -i -t2 '{}' +
@@ -25,9 +14,9 @@ flake8:
2514
find alloydflanagan -name migrations -prune -o -name '*.py' -exec flake8 '{}' +
2615

2716
isort:
28-
isort alloydflanagan
17+
uv run isort alloydflanagan
2918

3019
black:
31-
black alloydflanagan
20+
uv run black alloydflanagan
3221

3322
lint: isort black flake8 djhtml

app/pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
[project]
2+
name = "alloydflanagan-wag"
3+
version = "0.1.0"
4+
description = "Personal web site for A. Lloyd Flanagan"
5+
readme = "README.md"
6+
requires-python = ">=3.13"
7+
dependencies = [
8+
"dj-database-url>=2.3.0",
9+
"django-htmx>=1.23.0",
10+
"django-redis>=5.4.0",
11+
"django-structlog>=9.1.1",
12+
"django-waffle>=4.2.0",
13+
"django-widget-tweaks>=1.5.0",
14+
"gunicorn>=23.0.0",
15+
"psycopg>=3.2.7",
16+
"structlog>=25.3.0",
17+
"wagtail==5.1.2",
18+
]
19+
20+
[dependency-groups]
21+
dev = [
22+
"coverage>=7.8.0",
23+
"django-coverage-plugin>=3.1.0",
24+
"django-debug-toolbar>=5.2.0",
25+
"django-stubs>=5.2.0",
26+
"djhtml>=3.0.7",
27+
"factory-boy>=3.3.3",
28+
"flake8-django>=1.4",
29+
"freezegun>=1.5.1",
30+
"ipython>=9.2.0",
31+
"isort>=6.0.1",
32+
"mypy>=1.15.0",
33+
"ruff>=0.11.8",
34+
"ruff-lsp>=0.0.62",
35+
"types-freezegun>=1.1.10",
36+
"types-python-dateutil>=2.9.0.20241206",
37+
"types-requests>=2.32.0.20250328",
38+
"vcrpy>=5.1.0",
39+
]
40+
141
[tool.isort]
242
line_length = 120
343
known_django = "django"

app/uv.lock

Lines changed: 1415 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

context.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# this docker file does nothing but make it easy to test your .dockerignore
22
# use same image as Dockerfile so we don't have to download any additional ones
3-
FROM python:3.11.5-slim-bookworm
3+
FROM python:3.12.5-slim-bookworm
44

55
RUN mkdir context
6-
COPY . context/
6+
COPY app context/

docker-compose.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
services:
44
wagtail:
5-
image: alflanagan-wagtail-dev
65
build:
76
context: .
8-
container_name: alf-wag
97
command: make run-server
108
volumes:
119
- ./app:/app:delegated
@@ -16,7 +14,6 @@ services:
1614

1715
postgres:
1816
image: postgres:alpine
19-
container_name: alf-pg
2017
environment:
2118
POSTGRES_USER: wagtail
2219
POSTGRES_PASSWORD: development
@@ -28,7 +25,6 @@ services:
2825

2926
redis:
3027
image: 'redis:7'
31-
container_name: "alf-redis"
3228
restart: on-failure
3329
volumes:
3430
- redis:/data

requirements.dev.in

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

0 commit comments

Comments
 (0)