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 d91962b commit 125d8a2
Show file tree
Hide file tree
Showing 7 changed files with 637 additions and 1,039 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,17 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: astral-sh/setup-uv@v3
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
enable-cache: true
- name: Install Python 3.11
run: uv python install 3.11

- 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
20 changes: 11 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
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 apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
RUN ls /root/.cargo
ENV PATH="/root/.cargo/bin:$PATH"

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.

994 changes: 0 additions & 994 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 '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 125d8a2

Please sign in to comment.