Use uv Package Manager
uv is an extremely fast Python package manager written in Rust. It can replace pip for dependency installation and is significantly faster, especially for projects with many dependencies.
Why Use uv?
- Speed: uv installs packages 10-100x faster than pip
- Compatibility: Drop-in replacement for pip in most cases
- Caching: Efficient dependency caching reduces build times further
Using uv with a Build Command
The simplest way to use uv on Appliku is to install it as part of your build command. In your application's Build Settings, set the build command to:
With requirements.txt
pip install uv && uv pip install -r requirements.txt --system
With pyproject.toml
pip install uv && uv pip install . --system
The --system flag tells uv to install packages into the system Python environment rather than creating a virtual environment. This is necessary because Appliku builds run inside a Docker container where the system environment is the target.
Using uv with a Custom Dockerfile
For full control over the build process, use uv in your Dockerfile:
FROM python:3.12-slim
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
# Copy dependency files first for better caching
COPY requirements.txt .
# Install dependencies with uv
RUN uv pip install -r requirements.txt --system
# Copy application code
COPY . .
# Collect static files
RUN python manage.py collectstatic --noinput
CMD ["gunicorn", "myproject.wsgi", "--bind", "0.0.0.0:8000"]
Copying the uv binary from the official image (ghcr.io/astral-sh/uv:latest) is faster than installing it with pip and ensures you always get the latest version.
Using uv with pyproject.toml and Lockfile
If your project uses uv.lock for reproducible builds:
FROM python:3.12-slim
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN uv pip install -r uv.lock --system
COPY . .
RUN python manage.py collectstatic --noinput
CMD ["gunicorn", "myproject.wsgi", "--bind", "0.0.0.0:8000"]
Build Time Comparison
On a typical Django project with 50+ dependencies, you can expect:
| Method | Approximate Build Time |
|---|---|
| pip install | 30-60 seconds |
| uv pip install | 2-5 seconds |
The difference is more pronounced on larger projects and slower network connections.