Skip to content

Commit

Permalink
Switch from pip-tools to uv
Browse files Browse the repository at this point in the history
Note: pip-tools is making --strip-extras the default in 8.0, which uv
has copied by default.

This change also ensures a user has uv installed in the local venv so
the tooling works, and can take advantage of the python that venv is
using.
  • Loading branch information
ghickman committed May 22, 2024
1 parent 7134895 commit a29aa78
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ help:
@echo " make run-prod: run webserver as in deployed environment."
@echo " make compile: compile the requirements specs."

_uv:
# ensure uv is installed
pip install uv

test:
coverage run -m pytest -vvv
coverage report
Expand All @@ -14,8 +18,8 @@ mypy:
mypy . | mypy-json-report > mypy-ratchet.json
git diff --exit-code mypy-ratchet.json

build:
pip install -r requirements.prod.txt -r requirements.dev.txt
build: _uv
uv pip install -r requirements.prod.txt -r requirements.dev.txt
python manage.py collectstatic --no-input
rm --force ccbv.sqlite
DATABASE_URL=sqlite:///ccbv.sqlite python manage.py migrate
Expand All @@ -24,6 +28,6 @@ build:
run-prod:
DATABASE_URL=sqlite:///ccbv.sqlite gunicorn core.wsgi --log-file -

compile:
pip-compile requirements.prod.in --output-file=requirements.prod.txt
pip-compile requirements.dev.in --output-file=requirements.dev.txt
compile: _uv
uv pip compile requirements.prod.in --output-file=requirements.prod.txt
uv pip compile requirements.dev.in --output-file=requirements.dev.txt
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ After this, install as you normally would a Django site (requirements files are

e.g. (inside your virtualenv or whatever)

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

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

Expand Down
10 changes: 3 additions & 7 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements.dev.txt requirements.dev.in
#
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.dev.in --output-file=requirements.dev.txt
attrs==21.4.0
# via
# -c requirements.prod.txt
Expand All @@ -12,7 +8,7 @@ backports-entry-points-selectable==1.2.0
# via virtualenv
cfgv==3.3.1
# via pre-commit
coverage[toml]==6.5.0
coverage==6.5.0
# via -r requirements.dev.in
distlib==0.3.3
# via virtualenv
Expand Down
15 changes: 5 additions & 10 deletions requirements.prod.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=requirements.prod.txt requirements.prod.in
#
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.prod.in --output-file=requirements.prod.txt
asgiref==3.4.1
# via django
attrs==21.4.0
Expand Down Expand Up @@ -32,7 +28,7 @@ django-sans-db==1.2.0
# via -r requirements.prod.in
docutils==0.17.1
# via sphinx
environs[django]==9.5.0
environs==9.5.0
# via -r requirements.prod.in
gunicorn==20.1.0
# via -r requirements.prod.in
Expand Down Expand Up @@ -60,6 +56,8 @@ pytz==2021.3
# via django
requests==2.26.0
# via -r requirements.prod.in
setuptools==70.0.0
# via gunicorn
six==1.16.0
# via blessings
sphinx==1.2.2
Expand All @@ -72,6 +70,3 @@ werkzeug==2.0.2
# via -r requirements.prod.in
whitenoise==5.3.0
# via -r requirements.prod.in

# The following packages are considered to be unsafe in a requirements file:
# setuptools

0 comments on commit a29aa78

Please sign in to comment.