From 08aca7e15c43570ec5f8d04f1d6509801acd9e8b Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Thu, 18 Jan 2024 06:41:02 -0500 Subject: [PATCH] ci: properly install sqlalchemy2 deps; avoid relocking as a dependency --- .github/workflows/ibis-backends.yml | 74 ++++------------------------- 1 file changed, 9 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ibis-backends.yml b/.github/workflows/ibis-backends.yml index 1beeefe9b696..60206c8a9a2f 100644 --- a/.github/workflows/ibis-backends.yml +++ b/.github/workflows/ibis-backends.yml @@ -585,51 +585,9 @@ jobs: with: flags: backend,pyspark,${{ runner.os }},python-${{ steps.install_python.outputs.python-version }} - gen_lockfile_sqlalchemy2: - name: Generate Poetry Lockfile for SQLAlchemy 2 - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4 - - - name: install python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - run: python -m pip install --upgrade pip 'poetry==1.7.1' - - - name: remove deps that are not compatible with sqlalchemy 2 - run: poetry remove snowflake-sqlalchemy sqlalchemy-exasol - - - name: add sqlalchemy 2 - run: poetry add --lock --optional 'sqlalchemy>=2,<3' - - - name: checkout the lock file - run: git checkout poetry.lock - - - name: lock with no updates - # poetry add is aggressive and will update other dependencies like - # numpy and pandas so we keep the pyproject.toml edits and then relock - # without updating anything except the requested versions - run: poetry lock --no-update - - - name: check the sqlalchemy version - run: poetry show sqlalchemy --no-ansi | grep version | cut -d ':' -f2- | sed 's/ //g' | grep -P '^2\.' - - - name: upload deps file - uses: actions/upload-artifact@v3 - with: - name: deps - path: | - pyproject.toml - poetry.lock - test_backends_sqlalchemy2: name: SQLAlchemy 2 ${{ matrix.backend.title }} ${{ matrix.os }} python-${{ matrix.python-version }} runs-on: ${{ matrix.os }} - needs: - - gen_lockfile_sqlalchemy2 strategy: fail-fast: false matrix: @@ -708,37 +666,23 @@ jobs: if: matrix.backend.services != null run: docker compose up --wait ${{ join(matrix.backend.services, ' ') }} + - name: install poetry + run: pipx install 'poetry==1.7.1' + - name: install python uses: actions/setup-python@v5 id: install_python with: python-version: ${{ matrix.python-version }} - - name: download poetry lockfile - uses: actions/download-artifact@v3 - with: - name: deps - path: deps - - - name: pull out lockfile - run: | - set -euo pipefail - - mv -f deps/* . - rm -r deps - - - uses: syphar/restore-virtualenv@v1 - with: - requirement_files: poetry.lock - custom_cache_key_element: ${{ matrix.backend.name }}-${{ steps.install_python.outputs.python-version }} + - name: remove deps that are not compatible with sqlalchemy 2 + run: poetry remove snowflake-sqlalchemy sqlalchemy-exasol - - uses: syphar/restore-pip-download-cache@v1 - with: - requirement_files: poetry.lock - custom_cache_key_element: ${{ steps.install_python.outputs.python-version }} + - name: add sqlalchemy 2 + run: poetry update sqlalchemy - - name: install poetry - run: python -m pip install --upgrade pip 'poetry==1.7.1' + - name: check sqlalchemy is version 2 + run: poetry run python -c 'import sqlalchemy as sa; assert sa.__version__[0] == "2", sa.__version__' - name: install ibis run: poetry install --without dev --without docs --extras "${{ join(matrix.backend.extras, ' ') }}"