Skip to content

Make uv a dependency manager option #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ LICENSE
**/__pycache__/
tests/
postgres/
.venv
22 changes: 19 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
FROM pennlabs/django-base:b269ea1613686b1ac6370154debbb741b012de1a-3.11
ARG DEPENDENCY_MANAGER="pipenv"

LABEL maintainer="Penn Labs"

# Install uv
COPY --from=ghcr.io/astral-sh/uv@sha256:2381d6aa60c326b71fd40023f921a0a3b8f91b14d5db6b90402e65a635053709 /uv /uvx /bin/

# Copy project dependencies
COPY Pipfile* /app/
COPY Pipfile* pyproject.toml uv.lock /app/

# Install dependencies using uv or pipenv depending on DEPENDENCY_MANAGER arg
RUN if [ "$DEPENDENCY_MANAGER" = "uv" ]; then \
uv sync --frozen --no-dev --no-install-project --python $(which python); \
mv /app/.venv/bin/uwsgi /usr/local/bin/uwsgi; \
mv /app/.venv/bin/gunicorn /usr/local/bin/gunicorn; \
else \
pipenv install --system; \
fi

# Make installed binaries available for POSIX compliant scripts
ENV PATH="/app/.venv/bin:$PATH"

# Install project dependencies
RUN pipenv install --system
# Patch for scripts that use a hard-coded path to python (django-run, asgi-run)
ENV PYTHONPATH="/app/.venv/lib/python3.11/site-packages/:$PYTHONPATH"

# Copy project files
COPY . /app/
Expand Down
58 changes: 58 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,60 @@
[project]
name = ""
version = "0.0.1"
requires-python = "==3.11.4"
dependencies = [
"dj-database-url==2.2.0",
"djangorestframework==3.15.2",
"psycopg2-binary==2.9.6",
"uvloop==0.17.0",
"sentry-sdk",
"django==5.0.3",
"django-cors-headers==4.4.0",
"pyyaml==6.0.2",
"uritemplate==4.1.1",
"uwsgi==2.0.27",
"django-labs-accounts==0.7.1",
"django-phonenumber-field[phonenumbers]==8.0.0",
"drf-nested-routers==0.94.1",
"django-email-tools==0.1.1",
"twilio==9.3.3",
"djangorestframework-camel-case==1.4.2",
"django-filter==24.3",
"celery==5.4.0",
"redis==5.1.1",
"django-auto-prefetching==0.2.12",
"django-rest-live==0.7.0",
"channels==3.0.5",
"channels-redis==4.2.0",
"uvicorn[standard]==0.31.0",
"gunicorn==23.0.0",
"django-schedules-ohq==0.10.1.4",
"typing-extensions==4.12.2",
"drf-excel==2.4.1",
"pytz==2024.2",
"inflection==0.5.1",
]

[tool.black]
line-length = 100

[dependency-groups]
dev = [
"black==22.3.0",
"unittest-xml-reporting==3.2.0",
"flake8==7.1.1",
"flake8-absolute-import==1.0.0.2",
"flake8-isort==6.1.1",
"flake8-quotes==3.4.0",
"django-debug-toolbar==4.4.6",
"django-extensions==3.2.3",
"parameterized==0.9.0",
"tblib==3.0.0",
]

[tool.uv]
package = false

[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple"
Loading
Loading