diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd90ca1..f0d6ae3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,16 +72,19 @@ jobs: run: pytest tests/test_encoding.py tests/test_utils.py tests/test_config.py -v database: - name: PostgreSQL ${{ matrix.postgres }} (py${{ matrix.python }}) + name: PostgreSQL ${{ matrix.postgres }} (py${{ matrix.python }}${{ matrix.psycopg && format(', psycopg {0}', matrix.psycopg) || '' }}) runs-on: ubuntu-latest strategy: fail-fast: false # Rather than the full cross product, pin the corners: the oldest # supported pair, the newest pair, and the combination LMFDB actually # deploys. Add a row here when a new PostgreSQL major is released. + # The extra oldest-pair row pins psycopg to the declared minimum + # (pyproject's pgbinary/pgsource floor), so the floor stays honest. matrix: include: - {python: "3.9", postgres: "13"} + - {python: "3.9", postgres: "13", psycopg: "3.2.4"} - {python: "3.11", postgres: "15"} - {python: "3.12", postgres: "16"} - {python: "3.13", postgres: "17"} @@ -121,6 +124,10 @@ jobs: - name: Install run: python -m pip install -e ".[pgbinary,test]" + - name: Pin psycopg to the declared minimum + if: matrix.psycopg + run: python -m pip install "psycopg[binary]==${{ matrix.psycopg }}" + - name: Show server version run: psql -c "SELECT version()" diff --git a/CHANGELOG.md b/CHANGELOG.md index 482e89f..9b6bff4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,9 @@ migration note. psycopg2, and it re-exports `SQL`, `Identifier`, `Placeholder`, `Literal`, `Composable` and `Composed` from `psycodict` so callers need not import a driver directly. *Migration:* install with the `pgbinary` or `pgsource` extra - (`pip install "psycodict[pgbinary]"`), and import the SQL composition classes + (`pip install "psycodict[pgbinary]"`; psycopg 3.2.4 or newer -- the + notification listener relies on psycopg 3.2 APIs and on 3.2.4's + notification-delivery fix), and import the SQL composition classes from `psycodict` rather than `psycopg2.sql`. (#88) - **The old `join_search` method is removed.** *Migration:* pass `join=` to `search` (or `count` / `lucky`) instead; see the joins section of diff --git a/README.md b/README.md index 9953f58..4ba7581 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ builds; install psycodict with one of the two extras: ``` pip install "psycodict[pgbinary]" # pulls in psycopg[binary]; no system libpq needed -pip install "psycodict[pgsource]" # pulls in psycopg; builds against your system libpq +pip install "psycodict[pgsource]" # pulls in pure-Python psycopg, which uses your system libpq ``` ## Quickstart @@ -128,7 +128,7 @@ See the [CHANGELOG](https://github.com/roed314/psycodict/blob/main/CHANGELOG.md) - Python 3.9 or newer. - PostgreSQL 13 through 18. -- psycopg 3 (installed through the `pgbinary` or `pgsource` extra above). +- psycopg 3.2.4 or newer (installed through the `pgbinary` or `pgsource` extra above). ## Setting up PostgreSQL diff --git a/pyproject.toml b/pyproject.toml index 4f43569..71e3ce5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,8 +37,12 @@ Repository = "https://github.com/roed314/psycodict" Changelog = "https://github.com/roed314/psycodict/blob/main/CHANGELOG.md" [project.optional-dependencies] -pgsource = ["psycopg>=3.1"] -pgbinary = ["psycopg[binary]>=3.1"] +# 3.2 introduced Connection.notifies(timeout=..., stop_after=...), which the +# notification listener uses, and 3.2.4 fixed notifications being dropped +# while no generator was consuming them -- essential for the pull-based +# NotificationListener.poll(). +pgsource = ["psycopg>=3.2.4"] +pgbinary = ["psycopg[binary]>=3.2.4"] test = ["pytest>=7"] [tool.setuptools.dynamic]