Skip to content

Commit

Permalink
Merge pull request #1729 from edgarrmondragon/1692-py313-wheels
Browse files Browse the repository at this point in the history
Build Python 3.13 wheels, drop support for Python 3.7
  • Loading branch information
dvarrazzo authored Oct 10, 2024
2 parents f9780aa + 4987362 commit eaeeb76
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 52 deletions.
21 changes: 7 additions & 14 deletions .appveyor/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +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}
- {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

Expand All @@ -41,17 +37,14 @@ environment:
PERL5LIB: .

# 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
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
Expand All @@ -64,23 +57,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
Expand Down
21 changes: 7 additions & 14 deletions .appveyor/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +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}
- {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

Expand All @@ -36,17 +32,14 @@ environment:
PERL5LIB: .

# 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
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
Expand All @@ -59,23 +52,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:
30 changes: 24 additions & 6 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: sdist-${{ matrix.package_name }}
path: |
dist/*.tar.gz
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -110,6 +111,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: linux-${{matrix.pyver}}-${{matrix.platform}}_${{matrix.arch}}
path: ./wheelhouse/*.whl

services:
Expand All @@ -128,30 +130,45 @@ jobs:
build-macos:
runs-on: macos-latest
runs-on: macos-${{ matrix.macver }}
if: true

strategy:
fail-fast: false
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
Expand All @@ -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
16 changes: 7 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@ 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"}
- {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.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"}
- {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
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions doc/src/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ The current `!psycopg2` implementation supports:
..
NOTE: keep consistent with setup.py and the /features/ page.
- Python versions from 3.7 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::
Expand Down
4 changes: 2 additions & 2 deletions psycopg/python.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <structmember.h>
Expand Down
1 change: 1 addition & 0 deletions scripts/build/appveyor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/build_libpq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;

*)
Expand Down
3 changes: 2 additions & 1 deletion scripts/build/wheel_macos_before_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
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
Expand Down Expand Up @@ -552,7 +551,7 @@ def is_py_64():
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],
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit eaeeb76

Please sign in to comment.