Skip to content

Commit

Permalink
Try switching to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmior committed Oct 23, 2024
1 parent 1f354ac commit d8622e2
Show file tree
Hide file tree
Showing 7 changed files with 630 additions and 1,036 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pipenv'
- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- run: pipenv install --dev
- run: pipenv run ruff check pylinks
- run: pipenv run python manage.py collectstatic --noinput
cache: 'pip'
cache_dependency_path: uv.lock

- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- run: uv sync
- run: uv run ruff check pylinks
- run: uv run python manage.py collectstatic --noinput
- run: psql -c 'CREATE DATABASE ci_test;' -h 127.0.0.1 -U postgres
- run: pipenv run python manage.py test
- run: uv run python manage.py test
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ FROM python:3.11-slim-buster
ENV LANG C.UTF-8

RUN apt-get -y update && apt-get -y autoremove
RUN pip install pipenv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh

RUN mkdir /app
WORKDIR /app

RUN apt-get install -y python python-pip python-dev

ADD Pipfile /app/Pipfile
ADD Pipfile.lock /app/Pipfile.lock
RUN pipenv install
ADD pyproject.toml /app/pyproject.toml
ADD uv.lock /app/uv.lock
RUN uv sync

ADD . /app
ENV DJANGO_SECRET_KEY=dummy
RUN pipenv run python manage.py collectstatic --noinput
RUN uv run python manage.py collectstatic --noinput
ENV DJANGO_SECRET_KEY=

EXPOSE 8000
CMD ["pipenv", "run", "newrelic-admin", "run-program", "gunicorn", "pylinks.wsgi:application", "--timeout", "120", "-b", "0.0.0.0:8000", "--access-logfile", "-"]
CMD ["uv", "run", "newrelic-admin", "run-program", "gunicorn", "pylinks.wsgi:application", "--timeout", "120", "-b", "0.0.0.0:8000", "--access-logfile", "-"]
26 changes: 0 additions & 26 deletions Pipfile

This file was deleted.

996 changes: 0 additions & 996 deletions Pipfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ kill_timeout = "5s"
auto_rollback = true

[deploy]
release_command = "bash -c 'pipenv run python manage.py migrate && pipenv run python manage.py update_index'"
release_command = "bash -c '(curl -LsSf https://astral.sh/uv/install.sh | sh) && uv run python manage.py migrate && uv run python manage.py update_index'"

[[services]]
protocol = "tcp"
Expand Down
37 changes: 37 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[project]
name = "pylinks"
version = "0.1.0"
description = "Searchable database of external links in Python"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"asgiref",
"certifi",
"charset-normalizer",
"dj-database-url",
"django",
"django-grappelli",
"django-haystack",
"gunicorn",
"idna",
"newrelic",
"packaging",
"psycopg2-binary",
"python-dateutil",
"pyuploadcare",
"requests",
"rollbar",
"six",
"sqlparse",
"typing-extensions",
"urllib3",
"whitenoise",
"whoosh",
]

[tool.uv]
dev-dependencies = [
"black",
"ruff",
"pre-commit",
]
576 changes: 576 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit d8622e2

Please # to comment.