diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2023-03-17 14:49:57 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2023-03-17 14:49:57 +0000 |
| commit | 9677af144f1d2cfa447438f8cdc5ac08e56df7da (patch) | |
| tree | d2d653e1d1a9b38df48dcb33c4186c4301caebba | |
| parent | d9539e3990acf19ee1a03690d4a7441d26a7fbfd (diff) | |
| parent | 1a5f0c0be11fa30296f20a1742807a57e2ff5459 (diff) | |
| download | sqlalchemy-9677af144f1d2cfa447438f8cdc5ac08e56df7da.tar.gz | |
Merge "Improved wheel pipeline" into main
| -rw-r--r-- | .github/workflows/create-wheels.yaml | 46 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/plugin/pytestplugin.py | 34 | ||||
| -rw-r--r-- | lib/sqlalchemy/util/_has_cy.py | 6 | ||||
| -rw-r--r-- | pyproject.toml | 3 |
4 files changed, 73 insertions, 16 deletions
diff --git a/.github/workflows/create-wheels.yaml b/.github/workflows/create-wheels.yaml index cc312dd93..4c871ba62 100644 --- a/.github/workflows/create-wheels.yaml +++ b/.github/workflows/create-wheels.yaml @@ -4,32 +4,47 @@ on: # run when a release has been created release: types: [created] + # push: + # branches: + # - "go_wheel_*" # env: - # comment TWINE_REPOSITORY_URL to use the real pypi. NOTE: change also the secret used in TWINE_PASSWORD - # TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ +# # comment TWINE_REPOSITORY_URL to use the real pypi. NOTE: change also the secret used in TWINE_PASSWORD +# TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ jobs: build_wheels: - name: Build ${{ matrix.wheel_mode }} wheels on ${{ matrix.os }} ${{ matrix.linux_archs }} + name: ${{ matrix.wheel_mode }} wheels ${{ matrix.python }} on ${{ matrix.os }} ${{ matrix.os == 'ubuntu-22.04' && matrix.linux_archs || '' }} runs-on: ${{ matrix.os }} strategy: matrix: + # emulated wheels on linux take too much time, split wheels into multiple runs + python: + - "cp37-* cp38-*" + - "cp39-* cp310-*" + - "cp311-*" + wheel_mode: + - compiled + os: + - "windows-2022" + - "macos-12" + - "ubuntu-22.04" + linux_archs: + # this is only meaningful on linux. windows and macos ignore exclude all but one arch + - "aarch64" + - "x86_64" + include: - - os: windows-2022 - wheel_mode: compiled - - os: macos-12 - wheel_mode: compiled - # emulated wheels on linux take too much time, so run two jobs - - os: ubuntu-22.04 - wheel_mode: compiled - linux_archs: "x86_64" - - os: ubuntu-22.04 - wheel_mode: compiled - linux_archs: "aarch64" # create pure python build - os: ubuntu-22.04 wheel_mode: pure-python + python: "cp-311*" + + exclude: + - os: "windows-2022" + linux_archs: "aarch64" + - os: "macos-12" + linux_archs: "aarch64" fail-fast: false @@ -61,6 +76,9 @@ jobs: uses: pypa/cibuildwheel@v2.12.1 env: CIBW_ARCHS_LINUX: ${{ matrix.linux_archs }} + CIBW_BUILD: ${{ matrix.python }} + # setting it here does not work on linux + # PYTHONNOUSERSITE: "1" - name: Set up Python for twine and pure-python wheel diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py index d590ecbe4..b5d248552 100644 --- a/lib/sqlalchemy/testing/plugin/pytestplugin.py +++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py @@ -10,6 +10,7 @@ import itertools import operator import os import re +import sys import uuid import pytest @@ -123,9 +124,42 @@ def collect_types_fixture(): collect_types.stop() +def _log_sqlalchemy_info(session): + import sqlalchemy + from sqlalchemy import __version__ + from sqlalchemy.util import has_compiled_ext + from sqlalchemy.util._has_cy import _CYEXTENSION_MSG + + greet = "sqlalchemy installation" + site = "no user site" if sys.flags.no_user_site else "user site loaded" + msgs = [ + f"SQLAlchemy {__version__} ({site})", + f"Path: {sqlalchemy.__file__}", + ] + + if has_compiled_ext(): + from sqlalchemy.cyextension import util + + msgs.append(f"compiled extension enabled, e.g. {util.__file__} ") + else: + msgs.append(f"compiled extension not enabled; {_CYEXTENSION_MSG}") + + pm = session.config.pluginmanager.get_plugin("terminalreporter") + if pm: + pm.write_sep("=", greet) + for m in msgs: + pm.write_line(m) + else: + # fancy pants reporter not found, fallback to plain print + print("=" * 25, greet, "=" * 25) + for m in msgs: + print(m) + + def pytest_sessionstart(session): from sqlalchemy.testing import asyncio + _log_sqlalchemy_info(session) asyncio._assume_async(plugin_base.post_begin) diff --git a/lib/sqlalchemy/util/_has_cy.py b/lib/sqlalchemy/util/_has_cy.py index 1fe8cbe6a..37f716ad3 100644 --- a/lib/sqlalchemy/util/_has_cy.py +++ b/lib/sqlalchemy/util/_has_cy.py @@ -21,15 +21,19 @@ def _import_cy_extensions(): return (collections, immutabledict, processors, resultproxy, util) +_CYEXTENSION_MSG: str if not typing.TYPE_CHECKING: if os.environ.get("DISABLE_SQLALCHEMY_CEXT_RUNTIME"): HAS_CYEXTENSION = False + _CYEXTENSION_MSG = "DISABLE_SQLALCHEMY_CEXT_RUNTIME is set" else: try: _import_cy_extensions() - except ImportError: + except ImportError as err: HAS_CYEXTENSION = False + _CYEXTENSION_MSG = str(err) else: + _CYEXTENSION_MSG = "Loaded" HAS_CYEXTENSION = True else: HAS_CYEXTENSION = False diff --git a/pyproject.toml b/pyproject.toml index ecf030a42..ae4c1fb13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,7 +70,8 @@ strict = true [tool.cibuildwheel] test-requires = "pytest pytest-xdist" -test-command = "pytest -c {project}/pyproject.toml -n2 -q --nomemory --notimingintensive --nomypy {project}/test" +# remove user site, otherwise the local checkout has precedence, disabling cyextensions +test-command = "python -s -m pytest -c {project}/pyproject.toml -n2 -q --nomemory --notimingintensive --nomypy {project}/test" build = "*" # python 3.6 is no longer supported by sqlalchemy |
