Skip to content

Commit d68ae31

Browse files
authored
Merge pull request #237 from classy-python/split-dependencies
Split dependencies
2 parents be2107c + 14a5126 commit d68ae31

8 files changed

Lines changed: 183 additions & 166 deletions

File tree

.github/workflows/python-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ jobs:
3030
with:
3131
python-version: "3.10"
3232
cache: "pip"
33-
cache-dependency-path: requirements.txt
33+
cache-dependency-path: requirements.*.txt
3434

3535
- name: Install Python dependencies
3636
run: |
3737
python -m pip install --upgrade pip
38-
pip install -r requirements.txt
38+
pip install -r requirements.prod.txt -r requirements.dev.txt
3939
4040
- name: Run pre-commit
4141
run: |

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ help:
44
@echo " make test: runs the tests."
55
@echo " make build: install as for a deployed environment."
66
@echo " make run-prod: run webserver as in deployed environment."
7+
@echo " make compile: compile the requirements specs."
8+
9+
_uv:
10+
# ensure uv is installed
11+
pip install uv
712

813
test:
914
coverage run -m pytest -vvv
@@ -13,12 +18,16 @@ mypy:
1318
mypy . | mypy-json-report > mypy-ratchet.json
1419
git diff --exit-code mypy-ratchet.json
1520

16-
build:
17-
pip install -r requirements.txt
21+
build: _uv
22+
uv pip install -r requirements.prod.txt -r requirements.dev.txt
1823
python manage.py collectstatic --no-input
1924
rm --force ccbv.sqlite
2025
DATABASE_URL=sqlite:///ccbv.sqlite python manage.py migrate
2126
DATABASE_URL=sqlite:///ccbv.sqlite python manage.py load_all_django_versions
2227

2328
run-prod:
2429
DATABASE_URL=sqlite:///ccbv.sqlite gunicorn core.wsgi --log-file -
30+
31+
compile: _uv
32+
uv pip compile requirements.prod.in --output-file=requirements.prod.txt
33+
uv pip compile requirements.dev.in --output-file=requirements.dev.txt

README.markdown

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ First you should install some OS libraries required for some packages, this can
4444

4545
sudo apt-get install python3-dev libmemcached-dev zlib1g-dev libpq-dev
4646

47-
After this, install as you normally would a Django site (requirements.txt provided).
47+
After this, install as you normally would a Django site (requirements files are provided).
4848

4949
e.g. (inside your virtualenv or whatever)
5050

51-
pip install -r requirements.txt
51+
[uv] pip install -r requirements.prod.txt -r requirements.dev.txt
5252

5353
Prepare the database (assuming you've got required database)
5454

@@ -77,10 +77,9 @@ If you hope to contribute any code, please install `pre-commit` before committin
7777

7878

7979
## Updating Requirements
80+
Add or remove the dependency from either `requirements.prod.in` or `requirements.dev.in` as appropriate.
8081

81-
Run `pip-compile` and `requirements.txt` will be updated based on the specs in `requirements.in`.
82-
83-
More details can be found on the [pip-tools](https://github.com/nvie/pip-tools) website.
82+
Run `make compile` and appropriate txt file will be updated.
8483

8584

8685
## Updating for New Versions of Django

requirements.dev.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--constraint requirements.prod.txt
2+
3+
coverage[toml]
4+
factory_boy
5+
mypy
6+
mypy-json-report>=0.1.3
7+
pre-commit
8+
pytest
9+
pytest-django
10+
pytest-subtests
11+
types-requests

requirements.dev.txt

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile requirements.dev.in --output-file=requirements.dev.txt
3+
attrs==21.4.0
4+
# via
5+
# -c requirements.prod.txt
6+
# pytest
7+
backports-entry-points-selectable==1.2.0
8+
# via virtualenv
9+
cfgv==3.3.1
10+
# via pre-commit
11+
coverage==6.5.0
12+
# via -r requirements.dev.in
13+
distlib==0.3.3
14+
# via virtualenv
15+
factory-boy==3.2.0
16+
# via -r requirements.dev.in
17+
faker==9.3.1
18+
# via factory-boy
19+
filelock==3.3.0
20+
# via virtualenv
21+
identify==2.3.0
22+
# via pre-commit
23+
iniconfig==1.1.1
24+
# via pytest
25+
mypy==0.931
26+
# via -r requirements.dev.in
27+
mypy-extensions==0.4.3
28+
# via mypy
29+
mypy-json-report==0.1.3
30+
# via -r requirements.dev.in
31+
nodeenv==1.6.0
32+
# via pre-commit
33+
packaging==21.3
34+
# via
35+
# -c requirements.prod.txt
36+
# pytest
37+
platformdirs==2.4.0
38+
# via virtualenv
39+
pluggy==1.0.0
40+
# via pytest
41+
pre-commit==2.15.0
42+
# via -r requirements.dev.in
43+
py==1.11.0
44+
# via pytest
45+
pyparsing==3.0.6
46+
# via
47+
# -c requirements.prod.txt
48+
# packaging
49+
pytest==7.1.2
50+
# via
51+
# -r requirements.dev.in
52+
# pytest-django
53+
# pytest-subtests
54+
pytest-django==4.5.2
55+
# via -r requirements.dev.in
56+
pytest-subtests==0.8.0
57+
# via -r requirements.dev.in
58+
python-dateutil==2.8.2
59+
# via faker
60+
pyyaml==6.0.1
61+
# via pre-commit
62+
six==1.16.0
63+
# via
64+
# -c requirements.prod.txt
65+
# python-dateutil
66+
# virtualenv
67+
text-unidecode==1.3
68+
# via faker
69+
toml==0.10.2
70+
# via pre-commit
71+
tomli==2.0.0
72+
# via
73+
# coverage
74+
# mypy
75+
# pytest
76+
types-requests==2.27.7
77+
# via -r requirements.dev.in
78+
types-urllib3==1.26.7
79+
# via types-requests
80+
typing-extensions==4.0.1
81+
# via mypy
82+
virtualenv==20.8.1
83+
# via pre-commit
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
attrs>=21.4.0
22
blessings
3-
coverage[toml]
43
django~=3.1.14
54
django-extensions
65
django-pygmy
76
django-sans-db>=1.2.0
87
environs[django]
9-
factory_boy
108
gunicorn
11-
mypy
12-
mypy-json-report>=0.1.3
13-
pre-commit
149
psycopg2-binary>=2.9.5
15-
pytest
16-
pytest-django
17-
pytest-subtests
1810
requests
1911
# New versions aren't supported yet
2012
sphinx==1.2.2
21-
types-requests
2213
werkzeug
2314
whitenoise

requirements.prod.txt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile requirements.prod.in --output-file=requirements.prod.txt
3+
asgiref==3.4.1
4+
# via django
5+
attrs==21.4.0
6+
# via -r requirements.prod.in
7+
blessings==1.7
8+
# via -r requirements.prod.in
9+
certifi==2022.12.7
10+
# via requests
11+
charset-normalizer==2.0.7
12+
# via requests
13+
dj-database-url==0.5.0
14+
# via environs
15+
dj-email-url==1.0.6
16+
# via environs
17+
django==3.1.14
18+
# via
19+
# -r requirements.prod.in
20+
# django-extensions
21+
django-cache-url==3.4.2
22+
# via environs
23+
django-extensions==3.1.3
24+
# via -r requirements.prod.in
25+
django-pygmy==0.1.5
26+
# via -r requirements.prod.in
27+
django-sans-db==1.2.0
28+
# via -r requirements.prod.in
29+
docutils==0.17.1
30+
# via sphinx
31+
environs==9.5.0
32+
# via -r requirements.prod.in
33+
gunicorn==20.1.0
34+
# via -r requirements.prod.in
35+
idna==3.3
36+
# via requests
37+
jinja2==3.0.2
38+
# via sphinx
39+
markupsafe==2.0.1
40+
# via jinja2
41+
marshmallow==3.18.0
42+
# via environs
43+
packaging==21.3
44+
# via marshmallow
45+
psycopg2-binary==2.9.5
46+
# via -r requirements.prod.in
47+
pygments==2.10.0
48+
# via
49+
# django-pygmy
50+
# sphinx
51+
pyparsing==3.0.6
52+
# via packaging
53+
python-dotenv==0.21.0
54+
# via environs
55+
pytz==2021.3
56+
# via django
57+
requests==2.26.0
58+
# via -r requirements.prod.in
59+
setuptools==70.0.0
60+
# via gunicorn
61+
six==1.16.0
62+
# via blessings
63+
sphinx==1.2.2
64+
# via -r requirements.prod.in
65+
sqlparse==0.4.2
66+
# via django
67+
urllib3==1.26.7
68+
# via requests
69+
werkzeug==2.0.2
70+
# via -r requirements.prod.in
71+
whitenoise==5.3.0
72+
# via -r requirements.prod.in

0 commit comments

Comments
 (0)