Skip to content

Commit 8f2bb93

Browse files
committed
Migrate to uv
# Conflicts: # requirements/common.txt # requirements/dev.txt # requirements/prod.txt
1 parent a14ffb0 commit 8f2bb93

File tree

14 files changed

+1344
-67
lines changed

14 files changed

+1344
-67
lines changed

.github/dependabot.yml

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

.github/workflows/docker-test-build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,29 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
req_file:
20-
- prod.txt
21-
- tests.txt
19+
dependency_groups:
20+
- prod
21+
- tests
2222

2323
# steps taken (and trimmed) from docker-publish.yml
2424
steps:
2525
- name: Checkout repository
2626
uses: actions/checkout@v4
2727

28-
- if: matrix.req_file != 'tests.txt'
29-
name: Test docker image build (${{ matrix.req_file }})
28+
- if: matrix.dependency_groups != 'tests'
29+
name: Test docker image build (${{ matrix.dependency_groups }})
3030
uses: docker/build-push-action@v6
3131
with:
3232
context: .
3333
push: false
3434
build-args: |
35-
REQ_FILE=requirements/${{ matrix.req_file }}
35+
DEPENDENCY_GROUPS=${{ matrix.dependency_groups }}
3636
37-
- if: matrix.req_file == 'tests.txt'
37+
- if: matrix.dependency_groups == 'tests'
3838
name: Set up Docker Compose
3939
uses: docker/setup-compose-action@v1
4040

41-
- if: matrix.req_file == 'tests.txt'
41+
- if: matrix.dependency_groups == 'tests'
4242
name: Run the tests via Docker
4343
run: |
4444
docker compose build

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ jobs:
3737
run: sudo apt-get update && sudo apt-get install -y gettext
3838
- name: Install dependencies
3939
run: |
40-
python -m pip install --upgrade pip setuptools
41-
python -m pip install -r requirements/tests.txt
40+
python -m uv sync --group tests
4241
- name: Set up databases
4342
run: |
4443
PGPASSWORD="postgres" createuser -U postgres -d djangoproject --superuser -h localhost

.pre-commit-config.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ repos:
2121
- id: end-of-file-fixer
2222
exclude: '(^djangoproject\/static\/js\/lib\/.*$)'
2323
exclude_types: [json, sql]
24-
- id: file-contents-sorter
25-
files: ^(requirements/\w*.txt)$
26-
args: ["--ignore-case"]
2724
- id: fix-byte-order-marker
2825
- id: mixed-line-ending
2926
- id: trailing-whitespace
@@ -64,3 +61,16 @@ repos:
6461
rev: 0.2.2
6562
hooks:
6663
- id: checkmake
64+
65+
- repo: https://github.com/tox-dev/pyproject-fmt
66+
rev: v2.11.0
67+
hooks:
68+
- id: pyproject-fmt
69+
args:
70+
[
71+
"--indent",
72+
"4",
73+
"--keep-full-version",
74+
"--max-supported-python",
75+
"3.12",
76+
]

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ RUN apt-get update \
2323
postgresql-client-17 \
2424
&& apt-get distclean
2525

26-
ARG REQ_FILE=requirements/prod.txt
26+
ARG DEPENDENCY_GROUPS=prod
2727
ARG BUILD_DEPENDENCIES="g++ gcc libc6-dev libpq-dev zlib1g-dev"
2828

2929
# install python dependencies
3030
COPY ./requirements ./requirements
3131
RUN apt-get update \
3232
&& apt-get install --assume-yes --no-install-recommends ${BUILD_DEPENDENCIES} \
33-
&& python3 -m pip install --no-cache-dir -r ${REQ_FILE} \
33+
&& uv sync --groups ${DEPENDENCY_GROUPS} \
3434
&& apt-get purge --assume-yes --auto-remove ${BUILD_DEPENDENCIES} \
3535
&& apt-get distclean
3636

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ compile-scss-debug:
2020
python -m pysassc $(SCSS)/output.scss $(STATIC)/css/output.css --sourcemap
2121

2222
install:
23-
python -m pip install --requirement requirements/dev.txt
23+
uv sync --group dev
2424

2525
migrations-check:
2626
python -m manage makemigrations --check --dry-run

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Install and run locally from a virtual environment
1616

1717
#. Install dependencies::
1818

19-
python3 -m pip install -r requirements/dev.txt
19+
uv sync --group dev
2020

2121
Alternatively, use the make task::
2222

@@ -153,7 +153,7 @@ or for a HTML-based report::
153153
tests manually using the ``test`` task of the ``Makefile``. Don't forget to
154154
install the test requirements with the following command first though::
155155

156-
python -m pip install -r requirements/tests.txt
156+
uv sync --group tests
157157

158158
Then run::
159159

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
context: ./
55
dockerfile: Dockerfile
66
args:
7-
- REQ_FILE=requirements/tests.txt
7+
- DEPENDENCY_GROUPS=tests
88
- BUILD_DEPENDENCIES=g++ gcc
99
entrypoint: ./docker-entrypoint.dev.sh
1010
command: python manage.py runserver 0.0.0.0:8000

pyproject.toml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[project]
2+
name = "djangoproject-com"
3+
version = "0.0.1"
4+
description = "Source code to djangoproject.com"
5+
requires-python = ">=3.12"
6+
classifiers = [
7+
"Framework :: Django",
8+
"Framework :: Django :: 5.2",
9+
"License :: OSI Approved :: BSD License",
10+
"Operating System :: OS Independent",
11+
"Programming Language :: Python :: 3 :: Only",
12+
"Programming Language :: Python :: 3.12",
13+
]
14+
dependencies = [
15+
"babel==2.17.0",
16+
"django==5.2.7",
17+
"django-admin-dracula==0.0.3",
18+
"django-contact-form==5.2.0",
19+
"django-countries==7.6.1",
20+
"django-hosts==7.0.0",
21+
"django-money==3.5.4",
22+
"django-push @ git+https://github.com/brutasse/django-push.git@22fda99641cfbd2f3075a723d92652a8e38220a5",
23+
"django-read-only==1.21.0",
24+
"django-recaptcha==4.1.0",
25+
"django-registration-redux==2.13",
26+
"docutils==0.21.2",
27+
"feedparser==6.0.12",
28+
"jinja2==3.1.6",
29+
"libsass==0.23.0",
30+
"markdown==3.9",
31+
"pillow==11.3.0",
32+
"pygments==2.19.2",
33+
"pykismet3==0.1.1",
34+
"requests==2.32.5",
35+
"sorl-thumbnail==12.11.0",
36+
"sphinx==8.1.3",
37+
"stripe==13.0.1",
38+
"time-machine==2.19.0",
39+
]
40+
41+
[dependency-groups]
42+
dev = [
43+
"black==25.9.0", # Used by Django's find_formatters and run_formatters
44+
"django-debug-toolbar==6.0.0",
45+
"pre-commit~=4.3.0",
46+
"psycopg[binary]==3.2.10",
47+
"watchdog==6.0.0",
48+
]
49+
50+
prod = [
51+
"gunicorn==23.0.0",
52+
"psycopg[c]==3.2.10",
53+
"redis==6.4.0",
54+
"sentry-sdk==2.42.1",
55+
]
56+
57+
# TODO: Consider merging with dev group
58+
tests = [
59+
"coverage==7.11.0",
60+
"requests-mock==1.12.1",
61+
"tblib>=3.0.0",
62+
]
63+
64+
[tool.uv]
65+
package = false

requirements/common.txt

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

0 commit comments

Comments
 (0)