From a59079a4f2c4af12224a385eff4397954b647293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Mon, 16 Sep 2024 13:23:46 -0600 Subject: [PATCH 1/8] Build Python 3.13 wheels --- .github/workflows/packages.yml | 30 ++++++++++++++++++++----- scripts/build/build_libpq.sh | 2 +- scripts/build/wheel_macos_before_all.sh | 3 ++- setup.py | 2 +- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index f74cf8e7..0eac1b10 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -27,6 +27,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: + name: sdist-${{ matrix.package_name }} path: | dist/*.tar.gz @@ -64,7 +65,7 @@ jobs: matrix: platform: [manylinux, musllinux] arch: [x86_64, i686, aarch64, ppc64le] - pyver: [cp37, cp38, cp39, cp310, cp311, cp312] + pyver: [cp38, cp39, cp310, cp311, cp312, cp313] runs-on: ubuntu-latest steps: @@ -81,7 +82,7 @@ jobs: key: libpq-${{ env.LIBPQ_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }} - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v2.21.2 env: CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_MANYLINUX_I686_IMAGE: manylinux2014 @@ -110,6 +111,7 @@ jobs: - uses: actions/upload-artifact@v4 with: + name: linux-${{matrix.pyver}}-${{matrix.platform}}_${{matrix.arch}} path: ./wheelhouse/*.whl services: @@ -128,7 +130,7 @@ jobs: build-macos: - runs-on: macos-latest + runs-on: macos-${{ matrix.macver }} if: true strategy: @@ -136,22 +138,37 @@ jobs: matrix: # These archs require an Apple M1 runner: [arm64, universal2] arch: [x86_64] - pyver: [cp37, cp38, cp39, cp310, cp311, cp312] + pyver: [cp38, cp39, cp310, cp311, cp312, cp313] + macver: ["12"] + include: + - arch: arm64 + pyver: cp310 + macver: "14" + - arch: arm64 + pyver: cp311 + macver: "14" + - arch: arm64 + pyver: cp312 + macver: "14" + - arch: arm64 + pyver: cp313 + macver: "14" steps: - name: Checkout repos uses: actions/checkout@v4 - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v2.21.2 env: CIBW_BUILD: ${{matrix.pyver}}-macosx_${{matrix.arch}} - CIBW_ARCHS_MACOS: x86_64 + CIBW_ARCHS_MACOS: ${{matrix.arch}} CIBW_BEFORE_ALL_MACOS: ./scripts/build/wheel_macos_before_all.sh CIBW_TEST_COMMAND: >- export PYTHONPATH={project} && python -c "import tests; tests.unittest.main(defaultTest='tests.test_suite')" CIBW_ENVIRONMENT: >- + MACOSX_DEPLOYMENT_TARGET=${{ matrix.macver }}.0 PG_VERSION=16 PACKAGE_NAME=psycopg2-binary PSYCOPG2_TESTDB=postgres @@ -161,4 +178,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: + name: macos-${{matrix.pyver}}-macos-${{matrix.macver}}_${{matrix.arch}} path: ./wheelhouse/*.whl diff --git a/scripts/build/build_libpq.sh b/scripts/build/build_libpq.sh index 6c722336..8a99fbe8 100755 --- a/scripts/build/build_libpq.sh +++ b/scripts/build/build_libpq.sh @@ -35,7 +35,7 @@ case "$ID" in alpine) apk upgrade - apk add --no-cache zlib-dev krb5-dev linux-pam-dev openldap-dev + apk add --no-cache zlib-dev krb5-dev linux-pam-dev openldap-dev openssl-dev ;; *) diff --git a/scripts/build/wheel_macos_before_all.sh b/scripts/build/wheel_macos_before_all.sh index 4aaee3f8..882b887f 100755 --- a/scripts/build/wheel_macos_before_all.sh +++ b/scripts/build/wheel_macos_before_all.sh @@ -12,9 +12,10 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" prjdir="$( cd "${dir}/../.." && pwd )" brew install gnu-sed postgresql@${PG_VERSION} +brew link --overwrite postgresql@${PG_VERSION} # Start the database for testing -brew services start postgresql +brew services start postgresql@${PG_VERSION} # Wait for postgres to come up for i in $(seq 10 -1 0); do diff --git a/setup.py b/setup.py index 572d8875..f7a8caa5 100644 --- a/setup.py +++ b/setup.py @@ -552,7 +552,7 @@ setup(name="psycopg2", url="https://psycopg.org/", license="LGPL with exceptions", platforms=["any"], - python_requires='>=3.7', + python_requires='>=3.8', description=readme.split("\n")[0], long_description="\n".join(readme.split("\n")[2:]).lstrip(), classifiers=[x for x in classifiers.split("\n") if x], From 26f0f13b393eeab8d8ea0f3838a7f8fcc906bae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Sat, 5 Oct 2024 01:29:06 -0600 Subject: [PATCH 2/8] Use `py` executable in appveyor --- .appveyor/packages.yml | 13 +++++-------- .appveyor/tests.yml | 13 +++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.appveyor/packages.yml b/.appveyor/packages.yml index 740b5e0e..4d4cb767 100644 --- a/.appveyor/packages.yml +++ b/.appveyor/packages.yml @@ -43,9 +43,6 @@ environment: # Select according to the service enabled POSTGRES_DIR: C:\Program Files\PostgreSQL\9.6\ - # The python used in the build process, not the one packages are built for - PYEXE: C:\Python36\python.exe - matrix: fast_finish: false @@ -64,23 +61,23 @@ cache: # Repository gets cloned, Cache is restored install: - - "%PYEXE% scripts\\build\\appveyor.py install" + - "py scripts\\build\\appveyor.py install" # PostgreSQL server starts now build: "off" build_script: - - "%PYEXE% scripts\\build\\appveyor.py build_script" + - "py scripts\\build\\appveyor.py build_script" after_build: - - "%PYEXE% scripts\\build\\appveyor.py after_build" + - "py scripts\\build\\appveyor.py after_build" before_test: - - "%PYEXE% scripts\\build\\appveyor.py before_test" + - "py scripts\\build\\appveyor.py before_test" test_script: - - "%PYEXE% scripts\\build\\appveyor.py test_script" + - "py scripts\\build\\appveyor.py test_script" artifacts: - path: dist\psycopg2-*\*.whl diff --git a/.appveyor/tests.yml b/.appveyor/tests.yml index 0cf91dda..a904b758 100644 --- a/.appveyor/tests.yml +++ b/.appveyor/tests.yml @@ -38,9 +38,6 @@ environment: # Select according to the service enabled POSTGRES_DIR: C:\Program Files\PostgreSQL\9.6\ - # The python used in the build process, not the one packages are built for - PYEXE: C:\Python36\python.exe - matrix: fast_finish: false @@ -59,23 +56,23 @@ cache: # Repository gets cloned, Cache is restored install: - - "%PYEXE% scripts\\build\\appveyor.py install" + - py scripts\\build\\appveyor.py install" # PostgreSQL server starts now build: "off" build_script: - - "%PYEXE% scripts\\build\\appveyor.py build_script" + - py scripts\\build\\appveyor.py build_script" after_build: - - "%PYEXE% scripts\\build\\appveyor.py after_build" + - py scripts\\build\\appveyor.py after_build" before_test: - - "%PYEXE% scripts\\build\\appveyor.py before_test" + - py scripts\\build\\appveyor.py before_test" test_script: - - "%PYEXE% scripts\\build\\appveyor.py test_script" + - py scripts\\build\\appveyor.py test_script" # vim: set ts=4 sts=4 sw=4: From 0eccfbec47d776979d8b6fd7d310bd36a53e8102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Sat, 5 Oct 2024 01:35:47 -0600 Subject: [PATCH 3/8] Ensure pg data dir exists --- scripts/build/appveyor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build/appveyor.py b/scripts/build/appveyor.py index d5e444df..6d97fa1e 100755 --- a/scripts/build/appveyor.py +++ b/scripts/build/appveyor.py @@ -99,6 +99,7 @@ def configure_postgres(): Set up PostgreSQL config before the service starts. """ logger.info("Configuring Postgres") + opt.pg_data_dir.mkdir(parents=True, exist_ok=True) with (opt.pg_data_dir / 'postgresql.conf').open('a') as f: # allow > 1 prepared transactions for test cases print("max_prepared_transactions = 10", file=f) From e1cf23d9c74ef520ead11fcacc73d17b8754ed00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Sat, 5 Oct 2024 01:40:45 -0600 Subject: [PATCH 4/8] Drop Python 3.7 in other places --- .appveyor/packages.yml | 2 -- .appveyor/tests.yml | 2 -- .github/workflows/tests.yml | 2 -- NEWS | 1 + doc/src/install.rst | 2 +- psycopg/python.h | 4 ++-- setup.py | 1 - tox.ini | 2 +- 8 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.appveyor/packages.yml b/.appveyor/packages.yml index 4d4cb767..c43bf117 100644 --- a/.appveyor/packages.yml +++ b/.appveyor/packages.yml @@ -21,8 +21,6 @@ environment: - {PY_VER: "39", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019} - {PY_VER: "38", PY_ARCH: "32", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} - {PY_VER: "38", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} - - {PY_VER: "37", PY_ARCH: "32", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} - - {PY_VER: "37", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} WORKFLOW: packages diff --git a/.appveyor/tests.yml b/.appveyor/tests.yml index a904b758..728b7c87 100644 --- a/.appveyor/tests.yml +++ b/.appveyor/tests.yml @@ -16,8 +16,6 @@ environment: - {PY_VER: "39", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019} - {PY_VER: "38", PY_ARCH: "32", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} - {PY_VER: "38", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} - - {PY_VER: "37", PY_ARCH: "32", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} - - {PY_VER: "37", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} WORKFLOW: tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0554d8b4..af7cef11 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,6 @@ jobs: fail-fast: false matrix: include: - - {python: "3.7", postgres: "10"} - {python: "3.8", postgres: "12"} - {python: "3.9", postgres: "13"} - {python: "3.10", postgres: "14"} @@ -22,7 +21,6 @@ jobs: - {python: "3.13-dev", postgres: "16"} # Opposite extremes of the supported Py/PG range, other architecture - - {python: "3.7", postgres: "16", architecture: "x86"} - {python: "3.8", postgres: "15", architecture: "x86"} - {python: "3.9", postgres: "14", architecture: "x86"} - {python: "3.10", postgres: "13", architecture: "x86"} diff --git a/NEWS b/NEWS index ce8c6aea..4940a91d 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ What's new in psycopg 2.9.10 (unreleased) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Add support for Python 3.13. +- Drop support for Python 3.7. What's new in psycopg 2.9.9 diff --git a/doc/src/install.rst b/doc/src/install.rst index 00d693a0..60354120 100644 --- a/doc/src/install.rst +++ b/doc/src/install.rst @@ -131,7 +131,7 @@ The current `!psycopg2` implementation supports: .. NOTE: keep consistent with setup.py and the /features/ page. -- Python versions from 3.7 to 3.12 +- Python versions from 3.8 to 3.12 - PostgreSQL server versions from 7.4 to 16 - PostgreSQL client library version from 9.1 diff --git a/psycopg/python.h b/psycopg/python.h index 37de2316..f8c2c0aa 100644 --- a/psycopg/python.h +++ b/psycopg/python.h @@ -27,8 +27,8 @@ #ifndef PSYCOPG_PYTHON_H #define PSYCOPG_PYTHON_H 1 -#if PY_VERSION_HEX < 0x03070000 -#error "psycopg requires Python 3.7" +#if PY_VERSION_HEX < 0x03080000 +#error "psycopg requires Python 3.8" #endif #include diff --git a/setup.py b/setup.py index f7a8caa5..be7af122 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,6 @@ Intended Audience :: Developers License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Programming Language :: Python Programming Language :: Python :: 3 -Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 diff --git a/tox.ini b/tox.ini index ce450d3d..c46872dd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {3.7,3.8,3.9,3.10,3.11,3.12,3.13} +envlist = {3.8,3.9,3.10,3.11,3.12,3.13} [testenv] commands = make check From dac8fa5632e714ed55ca76e5a4df5eb9c42e0afc Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 8 Oct 2024 17:04:40 +0200 Subject: [PATCH 5/8] ci(win): use PostgreSQL 13 for tests By latest errors, it seems that Postgres 9.6 is no more supported on VS2019 image. By documentation, it also seem that Postgres 13 is the most recent supported database and not available in VS2015 image. Therefore, drop Python 3.8 test (and likely build). See https://www.appveyor.com/docs/services-databases/#postgresql --- .appveyor/tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.appveyor/tests.yml b/.appveyor/tests.yml index 728b7c87..f630877b 100644 --- a/.appveyor/tests.yml +++ b/.appveyor/tests.yml @@ -14,8 +14,6 @@ environment: - {PY_VER: "310", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019} - {PY_VER: "39", PY_ARCH: "32", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019} - {PY_VER: "39", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019} - - {PY_VER: "38", PY_ARCH: "32", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} - - {PY_VER: "38", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} WORKFLOW: tests @@ -34,14 +32,14 @@ environment: PERL5LIB: . # Select according to the service enabled - POSTGRES_DIR: C:\Program Files\PostgreSQL\9.6\ + POSTGRES_DIR: C:\Program Files\PostgreSQL\13\ matrix: fast_finish: false services: # Note: if you change this service also change POSTGRES_DIR - - postgresql96 + - postgresql13 cache: # Rebuild cache if following file changes From 563b55a725920403bd18f7a5830d4045fe345395 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 8 Oct 2024 17:08:02 +0200 Subject: [PATCH 6/8] docs: bump supported versions to Python 3.13 and Postgres 17 --- doc/src/install.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/install.rst b/doc/src/install.rst index 60354120..0ff3f5d5 100644 --- a/doc/src/install.rst +++ b/doc/src/install.rst @@ -131,8 +131,8 @@ The current `!psycopg2` implementation supports: .. NOTE: keep consistent with setup.py and the /features/ page. -- Python versions from 3.8 to 3.12 -- PostgreSQL server versions from 7.4 to 16 +- Python versions from 3.8 to 3.13 +- PostgreSQL server versions from 7.4 to 17 - PostgreSQL client library version from 9.1 .. note:: From 8c9a35de38bb8e54acef52ebc32c0469f7a7d156 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 9 Oct 2024 19:37:29 +0200 Subject: [PATCH 7/8] ci: test with PostgreSQL 17 --- .github/workflows/tests.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index af7cef11..19baedff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,15 +18,15 @@ jobs: - {python: "3.10", postgres: "14"} - {python: "3.11", postgres: "15"} - {python: "3.12", postgres: "16"} - - {python: "3.13-dev", postgres: "16"} + - {python: "3.13-dev", postgres: "17"} # Opposite extremes of the supported Py/PG range, other architecture - - {python: "3.8", postgres: "15", architecture: "x86"} - - {python: "3.9", postgres: "14", architecture: "x86"} - - {python: "3.10", postgres: "13", architecture: "x86"} - - {python: "3.11", postgres: "11", architecture: "x86"} - - {python: "3.12", postgres: "10", architecture: "x86"} - - {python: "3.13-dev", postgres: "10", architecture: "x86"} + - {python: "3.8", postgres: "17", architecture: "x86"} + - {python: "3.9", postgres: "16", architecture: "x86"} + - {python: "3.10", postgres: "15", architecture: "x86"} + - {python: "3.11", postgres: "14", architecture: "x86"} + - {python: "3.12", postgres: "13", architecture: "x86"} + - {python: "3.13-dev", postgres: "12", architecture: "x86"} env: PSYCOPG2_TESTDB: postgres From 4987362fb4f36597aa52f4e1c5a0e30bab9a3edf Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 10 Oct 2024 15:48:48 +0200 Subject: [PATCH 8/8] ci(windows): drop Python 3.8 packages The runner image to build 3.8 package doesn't seem to have a currently supported database, and the previously used 9.6 is no more supported on current runners. --- .appveyor/packages.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.appveyor/packages.yml b/.appveyor/packages.yml index c43bf117..468b7594 100644 --- a/.appveyor/packages.yml +++ b/.appveyor/packages.yml @@ -19,8 +19,6 @@ environment: - {PY_VER: "310", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019} - {PY_VER: "39", PY_ARCH: "32", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019} - {PY_VER: "39", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019} - - {PY_VER: "38", PY_ARCH: "32", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} - - {PY_VER: "38", PY_ARCH: "64", APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015} WORKFLOW: packages @@ -39,14 +37,14 @@ environment: PERL5LIB: . # Select according to the service enabled - POSTGRES_DIR: C:\Program Files\PostgreSQL\9.6\ + POSTGRES_DIR: C:\Program Files\PostgreSQL\13\ matrix: fast_finish: false services: # Note: if you change this service also change POSTGRES_DIR - - postgresql96 + - postgresql13 cache: # Rebuild cache if following file changes