diff --git a/docker/alpine.Dockerfile b/docker/alpine.Dockerfile index 52588ba..fda3f07 100644 --- a/docker/alpine.Dockerfile +++ b/docker/alpine.Dockerfile @@ -23,7 +23,7 @@ ADD https://astral.sh/uv/0.8.13/install.sh /uv-installer.sh RUN chmod +x /uv-installer.sh && /uv-installer.sh # install python dependencies COPY pyproject.toml uv.lock ./ -RUN /root/.local/bin/uv sync --no-dev +RUN /root/.local/bin/uv sync --no-dev --group postgres FROM build-deps AS compile-icu diff --git a/docker/default.Dockerfile b/docker/default.Dockerfile index 9d54587..e2fad46 100644 --- a/docker/default.Dockerfile +++ b/docker/default.Dockerfile @@ -25,7 +25,7 @@ ADD https://astral.sh/uv/0.8.13/install.sh /uv-installer.sh RUN chmod +x /uv-installer.sh && /uv-installer.sh # install python dependencies COPY pyproject.toml uv.lock ./ -RUN /root/.local/bin/uv sync --no-dev +RUN /root/.local/bin/uv sync --no-dev --group postgres FROM build-deps AS compile-icu diff --git a/pyproject.toml b/pyproject.toml index 1fd0c76..d582786 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ dependencies = [ "huey>=2.5.1", "markdown>=3.7", "mozilla-django-oidc>=4.0.1", - "psycopg[binary]>=3.2.9", "python-dateutil>=2.9.0.post0", "requests>=2.32.4", "supervisor>=4.2.5", @@ -29,10 +28,21 @@ dev = [ "coverage>=7.10.4", "django-debug-toolbar>=6.0.0", "playwright>=1.54.0", + "psycopg[binary]>=3.2.9", "pytest>=8.4.1", "pytest-django>=4.11.1", "pytest-xdist>=3.8.0", ] +# For PostgreSQL support, use the binary release for development so that not +# everyone needs to build from source. For production, use a separate dependency +# group that builds the driver from source. uv also needs to build it from +# source to update the lockfile, which requires libpq. On macOS: +# - brew install libpq +# - export PATH="/opt/homebrew/opt/libpq/bin:$PATH" +# - uv add --group postgres psycopg[c] +postgres = [ + "psycopg[c]>=3.2.9", +] [tool.uv] # Prefer system Python for now, less complications when copying the venv in the Docker build diff --git a/uv.lock b/uv.lock index 26c6d91..ad31de4 100644 --- a/uv.lock +++ b/uv.lock @@ -363,7 +363,6 @@ dependencies = [ { name = "huey" }, { name = "markdown" }, { name = "mozilla-django-oidc" }, - { name = "psycopg", extra = ["binary"] }, { name = "python-dateutil" }, { name = "requests" }, { name = "supervisor" }, @@ -377,10 +376,14 @@ dev = [ { name = "coverage" }, { name = "django-debug-toolbar" }, { name = "playwright" }, + { name = "psycopg", extra = ["binary"] }, { name = "pytest" }, { name = "pytest-django" }, { name = "pytest-xdist" }, ] +postgres = [ + { name = "psycopg", extra = ["c"] }, +] [package.metadata] requires-dist = [ @@ -394,7 +397,6 @@ requires-dist = [ { name = "huey", specifier = ">=2.5.1" }, { name = "markdown", specifier = ">=3.7" }, { name = "mozilla-django-oidc", specifier = ">=4.0.1" }, - { name = "psycopg", extras = ["binary"], specifier = ">=3.2.9" }, { name = "python-dateutil", specifier = ">=2.9.0.post0" }, { name = "requests", specifier = ">=2.32.4" }, { name = "supervisor", specifier = ">=4.2.5" }, @@ -408,10 +410,12 @@ dev = [ { name = "coverage", specifier = ">=7.10.4" }, { name = "django-debug-toolbar", specifier = ">=6.0.0" }, { name = "playwright", specifier = ">=1.54.0" }, + { name = "psycopg", extras = ["binary"], specifier = ">=3.2.9" }, { name = "pytest", specifier = ">=8.4.1" }, { name = "pytest-django", specifier = ">=4.11.1" }, { name = "pytest-xdist", specifier = ">=3.8.0" }, ] +postgres = [{ name = "psycopg", extras = ["c"], specifier = ">=3.2.9" }] [[package]] name = "markdown" @@ -517,6 +521,9 @@ wheels = [ binary = [ { name = "psycopg-binary", marker = "implementation_name != 'pypy'" }, ] +c = [ + { name = "psycopg-c", marker = "implementation_name != 'pypy'" }, +] [[package]] name = "psycopg-binary" @@ -536,6 +543,12 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7b/1d/bf54cfec79377929da600c16114f0da77a5f1670f45e0c3af9fcd36879bc/psycopg_binary-3.2.9-cp313-cp313-win_amd64.whl", hash = "sha256:2290bc146a1b6a9730350f695e8b670e1d1feb8446597bed0bbe7c3c30e0abcb", size = 2928009, upload-time = "2025-05-13T16:08:53.67Z" }, ] +[[package]] +name = "psycopg-c" +version = "3.2.9" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/83/7f/6147cb842081b0b32692bf5a0fdf58e9ac95418ebac1184d4431ec44b85f/psycopg_c-3.2.9.tar.gz", hash = "sha256:8c9f654f20c6c56bddc4543a3caab236741ee94b6732ab7090b95605502210e2", size = 609538, upload-time = "2025-05-13T16:11:19.856Z" } + [[package]] name = "pycparser" version = "2.22"