Skip to content

Commit

Permalink
Merge pull request #917 from psycopg/pg17
Browse files Browse the repository at this point in the history
Create binary packages with PostgreSQL 17 libpq
  • Loading branch information
dvarrazzo authored Sep 29, 2024
2 parents bea783d + 9c9369b commit 9af9267
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 43 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/packages-bin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ jobs:

env:
# Latest release: https://www.postgresql.org/ftp/source/
LIBPQ_VERSION: "16.3"
LIBPQ_VERSION: "17.0"
# Latest release: https://www.openssl.org/source/
# Note: 3.3.2 is broken:
# https://github.com/openssl/openssl/issues/25366
OPENSSL_VERSION: "3.3.1"

strategy:
Expand Down Expand Up @@ -45,7 +47,7 @@ jobs:
run: python3 ./tools/build/copy_to_binary.py

- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.21.1
with:
package-dir: psycopg_binary
env:
Expand Down Expand Up @@ -106,7 +108,7 @@ jobs:
pyver: [cp310, cp311, cp312, cp313]

env:
PG_VERSION: "16"
PG_VERSION: "17"

steps:
- uses: actions/checkout@v4
Expand All @@ -115,13 +117,17 @@ jobs:
run: python3 ./tools/build/copy_to_binary.py

- name: Install PostgreSQL on the runner
run: brew install gnu-sed postgresql@${PG_VERSION}
# As of 2024-09-28 postgresql@17 reports an error but it's available
# So in a few days we might be able to drop it.
run: |
brew update
brew install gnu-sed postgresql@${PG_VERSION}
- name: Start PostgreSQL service
run: brew services start postgresql@${PG_VERSION}

- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.21.1
with:
package-dir: psycopg_binary
env:
Expand Down Expand Up @@ -158,7 +164,7 @@ jobs:
pyver: [cp38, cp39, cp310, cp311, cp312, cp313]

env:
PG_VERSION: "16"
PG_VERSION: "17"

steps:
- uses: actions/checkout@v4
Expand All @@ -167,13 +173,15 @@ jobs:
run: python3 ./tools/build/copy_to_binary.py

- name: Install PostgreSQL on the runner
run: brew install gnu-sed postgresql@${PG_VERSION}
run: |
brew update
brew install gnu-sed postgresql@${PG_VERSION}
- name: Start PostgreSQL service
run: brew services start postgresql@${PG_VERSION}

- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.21.1
with:
package-dir: psycopg_binary
env:
Expand Down Expand Up @@ -222,7 +230,7 @@ jobs:
run: python3 ./tools/build/copy_to_binary.py

- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.21.1
with:
package-dir: psycopg_binary
env:
Expand Down
55 changes: 34 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ jobs:
matrix:
include:
# Test different combinations of Python, Postgres, libpq.
- {impl: python, python: "3.8", postgres: "postgres:11", libpq: newest}
- {impl: python, python: "3.9", postgres: "postgres:13"}
- {impl: python, python: "3.10", postgres: "postgres:14"}
- {impl: python, python: "3.11", postgres: "postgres:15", libpq: master}
- {impl: python, python: "3.12", postgres: "postgres:16", libpq: oldest}
- {impl: python, python: "3.13", postgres: "postgres:16"}

- {impl: c, python: "3.8", postgres: "postgres:16", libpq: newest}
- {impl: c, python: "3.9", postgres: "postgres:14", libpq: master}
- {impl: c, python: "3.10", postgres: "postgres:15"}
- {impl: c, python: "3.11", postgres: "postgres:12", libpq: oldest}
- {impl: c, python: "3.12", postgres: "postgres:11", libpq: newest}
- {impl: c, python: "3.13", postgres: "postgres:15"}

- {impl: python, python: "3.8", ext: gevent, postgres: "postgres:16"}
- {impl: python, python: "3.8", postgres: "postgres:17", libpq: oldest}
- {impl: python, python: "3.9", postgres: "postgres:16", libpq: master}
- {impl: python, python: "3.10", postgres: "postgres:15"}
- {impl: python, python: "3.11", postgres: "postgres:14"}
- {impl: python, python: "3.12", postgres: "postgres:13", libpq: newest}
- {impl: python, python: "3.13", postgres: "postgres:12"}

- {impl: c, python: "3.8", postgres: "postgres:12", libpq: master}
- {impl: c, python: "3.9", postgres: "postgres:13"}
- {impl: c, python: "3.10", postgres: "postgres:14"}
- {impl: c, python: "3.11", postgres: "postgres:15", libpq: oldest}
- {impl: c, python: "3.12", postgres: "postgres:16", libpq: newest}
- {impl: c, python: "3.13", postgres: "postgres:17"}

- {impl: python, python: "3.8", ext: gevent, postgres: "postgres:17"}
- {impl: c, python: "3.12", ext: gevent, postgres: "postgres:14"}
- {impl: python, python: "3.9", ext: dns, postgres: "postgres:14"}
- {impl: python, python: "3.9", ext: postgis, postgres: "postgis/postgis"}
Expand Down Expand Up @@ -129,7 +129,8 @@ jobs:
- name: Configure memory alignment tests
if: ${{ matrix.ext == 'align' }}
run: |
echo "CFLAGS=-fsanitize=undefined -Werror=strict-aliasing -Werror=odr -Werror=lto-type-mismatch" >> $GITHUB_ENV
echo "CFLAGS=-fsanitize=undefined -Werror=strict-aliasing -Werror=odr -Werror=lto-type-mismatch"
>> $GITHUB_ENV
echo "UBSAN_OPTIONS=halt_on_error=1" >> $GITHUB_ENV
echo "PYTEST_ADDOPTS=-v" >> $GITHUB_ENV
Expand Down Expand Up @@ -167,7 +168,7 @@ jobs:
# Don't run timing-based tests as they regularly fail.
# pproxy-based tests fail too, with the proxy not coming up in 2s.
NOT_MARKERS: "timing proxy mypy"
PG_VERSION: "16"
PG_VERSION: "17"

steps:
- uses: actions/checkout@v4
Expand All @@ -178,15 +179,23 @@ jobs:
allow-prereleases: true

- name: Install PostgreSQL on the runner
run: brew install postgresql@${PG_VERSION}
# On 2024-09-28 postgresql@17 installation failed but the package is
# available. So, in a few days, we might be able to drop "brew update".
run: |
brew update
brew install postgresql@${PG_VERSION}
- name: Start PostgreSQL service
run: brew services start postgresql@${PG_VERSION}

- name: Find the libpq
if: ${{ matrix.impl == 'python' }}
# NOTE: the libpq was found in:
# /opt/homebrew/opt/postgresql@${PG_VERSION}/lib before PG 17
# /opt/homebrew/opt/postgresql@${PG_VERSION}/lib/postgresql on PG 17
run: |
echo "DYLD_LIBRARY_PATH=/opt/homebrew/opt/postgresql@${PG_VERSION}/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=/opt/homebrew/opt/postgresql@${PG_VERSION}/lib/postgresql:/opt/homebrew/opt/postgresql@${PG_VERSION}/lib:$DYLD_LIBRARY_PATH" \
>> $GITHUB_ENV
- name: Include psycopg-c to the packages to install
if: ${{ matrix.impl == 'c' }}
Expand Down Expand Up @@ -224,7 +233,7 @@ jobs:
# Don't run timing-based tests as they regularly fail.
# pproxy-based tests fail too, with the proxy not coming up in 2s.
NOT_MARKERS: "timing proxy mypy"
PG_VERSION: "16"
PG_VERSION: "17"

steps:
- uses: actions/checkout@v4
Expand All @@ -234,7 +243,11 @@ jobs:
python-version: ${{ matrix.python }}

- name: Install PostgreSQL on the runner
run: brew install postgresql@${PG_VERSION}
# On 2024-09-28 postgresql@17 installation failed but the package is
# available. So, in a few days, we might be able to drop "brew update".
run: |
brew update
brew install gnu-sed postgresql@${PG_VERSION}
- name: Start PostgreSQL service
run: brew services start postgresql@${PG_VERSION}
Expand Down
1 change: 1 addition & 0 deletions docs/api/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ SQLSTATE Exception Base exception
``25P01`` `!NoActiveSqlTransaction` `!InternalError`
``25P02`` `!InFailedSqlTransaction` `!InternalError`
``25P03`` `!IdleInTransactionSessionTimeout` `!InternalError`
``25P04`` `!TransactionTimeout` `!InternalError`
**Class 26** - Invalid SQL Statement Name
---------------------------------------------------------------------------------
``26000`` `!InvalidSqlStatementName` `!ProgrammingError`
Expand Down
10 changes: 9 additions & 1 deletion docs/basic/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ The Psycopg version documented here has *official and tested* support for:

- **Note:** Only the pure Python version is supported.

- PostgreSQL: from version 10 to 16
- PostgreSQL: from version 10 to 17

- **Note:** PostgreSQL `currently supported release`__ are actively tested
in the CI. Out-of-support releases are supported on a best-effort basis.

Only the pure Python version is supported.

- OS: Linux, macOS, Windows

.. __: https://www.postgresql.org/support/versioning/

The tests to verify the supported systems run in `Github workflows`__:
anything that is not tested there is not officially supported. This includes:

Expand Down
6 changes: 6 additions & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
Current release
---------------

Psycopg 3.2.3
^^^^^^^^^^^^^

- Release binary packages including PostgreSQL 17 libpq (:ticket:`#852`).


Psycopg 3.2.2
^^^^^^^^^^^^^

Expand Down
7 changes: 5 additions & 2 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ When a new PostgreSQL major version is released
- Include the new version in GitHub Actions test and package grids.

- Bump ``PG_VERSION`` in the ``macos`` job of
``.github/workflows/packages-bin.yml``.

- ``.github/workflows/packages-bin.yml``.
- ``.github/workflows/tests.yml``.

- Bump ``pg_version`` in ``tools/build/build_macos_arm64.sh``.

Expand All @@ -88,8 +90,9 @@ When a new PostgreSQL major version is released
- ``docs/basic/install.rst``;
- ``content/features/contents.lr`` in the psycopg-website repository.


When a new Python major version is released
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Add the new version to the relevant test matrices in
``.github/workflows/tests.yml`` and ``.github/workflows/packages-bin.yml``.
Expand Down
2 changes: 1 addition & 1 deletion psycopg/psycopg/_oids.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Use tools/update_oids.py to update this data.
# autogenerated: start

# Generated from PostgreSQL 16.2
# Generated from PostgreSQL 17.0

ACLITEM_OID = 1033
BIT_OID = 1560
Expand Down
4 changes: 4 additions & 0 deletions psycopg/psycopg/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,10 @@ class IdleInTransactionSessionTimeout(InternalError,
code='25P03', name='IDLE_IN_TRANSACTION_SESSION_TIMEOUT'):
pass

class TransactionTimeout(InternalError,
code='25P04', name='TRANSACTION_TIMEOUT'):
pass


# Class 26 - Invalid SQL Statement Name

Expand Down
2 changes: 1 addition & 1 deletion psycopg/psycopg/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def register_default_types(types: TypesRegistry) -> None:
for t in [
TypeInfo('"char"', 18, 1002, typemod=CharTypeModifier),
# autogenerated: start
# Generated from PostgreSQL 16.2
# Generated from PostgreSQL 17.0
TypeInfo("aclitem", 1033, 1034),
TypeInfo("bit", 1560, 1561, typemod=BitTypeModifier),
TypeInfo("bool", 16, 1000, regtype="boolean"),
Expand Down
2 changes: 1 addition & 1 deletion psycopg_c/psycopg_c/_psycopg/oids.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cdef enum:

# autogenerated: start

# Generated from PostgreSQL 16.2
# Generated from PostgreSQL 17.0

ACLITEM_OID = 1033
BIT_OID = 1560
Expand Down
5 changes: 3 additions & 2 deletions tools/build/build_libpq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ source /etc/os-release
case "$ID" in
centos)
yum update -y
yum install -y zlib-devel krb5-devel pam-devel perl-IPC-Cmd
yum install -y flex krb5-devel pam-devel perl-IPC-Cmd zlib-devel
;;

alpine)
apk upgrade
apk add --no-cache zlib-dev krb5-dev linux-pam-dev openldap-dev openssl-dev
apk add --no-cache flex krb5-dev linux-pam-dev openldap-dev \
openssl-dev tzdata zlib-dev
;;

*)
Expand Down
2 changes: 1 addition & 1 deletion tools/build/build_macos_arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
set -euo pipefail

python_versions="3.8.19 3.9.19 3.10.14 3.11.9 3.12.5 3.13.0rc1"
pg_version=16
pg_version=17

function log {
echo "$@" >&2
Expand Down
4 changes: 1 addition & 3 deletions tools/build/wheel_linux_before_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ source /etc/os-release
case "$ID" in
alpine)
# tzdata is required for datetime tests.
apk update
apk add --no-cache tzdata
"${dir}/build_libpq.sh" > /dev/null
;;

Expand All @@ -33,7 +31,7 @@ case "$ID" in

apt-get update
apt-get -y upgrade
apt-get -y install libpq-dev
apt-get -y install libpq-dev flex
;;

centos)
Expand Down
2 changes: 1 addition & 1 deletion tools/update_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


def main():
classes, errors = fetch_errors("9.6 10 11 12 13 14 15 16".split())
classes, errors = fetch_errors("9.6 10 11 12 13 14 15 16 17".split())

fn = os.path.dirname(__file__) + "/../psycopg/psycopg/errors.py"
update_file(fn, generate_module_data(classes, errors))
Expand Down

0 comments on commit 9af9267

Please sign in to comment.