Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dev-deps): use unified lock file format for conda lock files #7390

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
conda-lock/*.lock linguist-generated=true
ci/conda-lock/python-*.yml linguist-generated=true
flake.lock linguist-generated=true
poetry.lock linguist-generated=true
requirements.txt linguist-generated=true
Expand Down
70 changes: 9 additions & 61 deletions .github/workflows/conda-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,27 @@ jobs:

- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: latest
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: conda-lock
channels: conda-forge
channel-priority: strict
python-version: "3.11"
condarc-file: ci/conda-lock/condarc
use-mamba: true

- name: install conda libmamba solver
run: conda install -n base conda-libmamba-solver

- name: set solver to libmamba
run: conda config --set solver libmamba

- name: install conda-lock
run: conda install conda-lock=1.4
run: mamba install --name base conda-lock=2.3

- name: generate lock file
run: ./ci/conda-lock/generate.sh "${{ matrix.python-version }}"
run: ./ci/conda-lock/generate.sh ${{ matrix.python-version }} --lockfile ci/conda-lock/python-${{ matrix.python-version }}.yml

- name: create conda environment
run: conda create --name ibis${{ matrix.python-version }} --file conda-lock/linux-64-${{ matrix.python-version }}.lock
run: conda-lock install --name ibis${{ matrix.python-version }} --file ci/conda-lock/python-${{ matrix.python-version }}.yml

- name: upload conda lock files
uses: actions/upload-artifact@v3
with:
name: conda-lock-files-${{ github.run_attempt }}
path: conda-lock/*-${{ matrix.python-version }}.lock
path: ci/conda-lock/python-*.yml

condalock_pr:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
Expand Down Expand Up @@ -81,7 +75,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: conda-lock-files-${{ github.run_attempt }}
path: conda-lock
path: ci/conda-lock

- uses: peter-evans/create-pull-request@v5
id: create_pr
Expand All @@ -90,7 +84,7 @@ jobs:
commit-message: "chore(conda-lock): relock"
branch: "create-pull-request/conda-relock"
delete-branch: true
add-paths: conda-lock/*.lock
add-paths: ci/conda-lock/python-*.yml
committer: "ibis-squawk-bot[bot] <ibis-squawk-bot[bot]@users.noreply.github.com>"
author: "ibis-squawk-bot[bot] <ibis-squawk-bot[bot]@users.noreply.github.com>"
title: "chore(conda-lock): relock"
Expand All @@ -110,49 +104,3 @@ jobs:
token: ${{ steps.generate_pr_token.outputs.token }}
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }}
merge-method: rebase

condalock_push:
if: github.event_name == 'repository_dispatch'
runs-on: ubuntu-latest
needs:
- condalock
steps:
- uses: tibdex/github-app-token@v2
id: generate_token
with:
app_id: ${{ secrets.SQUAWK_BOT_APP_ID }}
private_key: ${{ secrets.SQUAWK_BOT_APP_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}

- name: download conda lock files
uses: actions/download-artifact@v3
with:
name: conda-lock-files-${{ github.run_attempt }}
path: conda-lock

- name: Configure git info
run: |
set -euo pipefail

git config --global user.name 'ibis-squawk-bot[bot]'
git config --global user.email 'ibis-squawk-bot[bot]@users.noreply.github.com'

- name: commit lock files and push to PR
run: |
set -euo pipefail

git add conda-lock/*.lock

if git commit -m 'chore(conda-lock): relock'; then
# pull in case another commit happened in the meantime
#
# `ours` is actually the *other* changeset, not the current branch, per
# https://stackoverflow.com/a/3443225/564538
git pull --rebase -s recursive -X ours
git push
fi
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ repos:
rev: v4.5.0
hooks:
- id: check-added-large-files
args: ["--maxkb=700"]
args: ["--maxkb=710"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The megalockfiles are right at 705 😬

- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
Expand Down Expand Up @@ -89,6 +89,7 @@ repos:
- json
- markdown
- yaml
exclude: ci/conda-lock/python-.+\.yml
- id: taplo
name: taplo
language: system
Expand Down
1 change: 1 addition & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extends: default

ignore:
- docs/_publish.yml
- ci/conda-lock/python-*.yml

rules:
document-start: disable
Expand Down
3 changes: 3 additions & 0 deletions ci/conda-lock/condarc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ channels:
- conda-forge
channel_priority: strict

# use mamba for SAT solving
solver: libmamba

always_yes: true

# remote_connect_timeout_secs (float)
Expand Down
50 changes: 21 additions & 29 deletions ci/conda-lock/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,14 @@

set -euo pipefail

python_version="${1}"
python_version_file="$(mktemp --suffix=.yml)"

{
echo 'name: conda-lock'
echo 'dependencies:'
echo " - python=${python_version}"
} > "${python_version_file}"

extras=(
-e bigquery
-e clickhouse
-e dask
-e datafusion
-e druid
-e duckdb
# this doesn't work on any platform yet (issues with resolving some google deps)
# -e geospatial
-e geospatial
-e impala
-e mssql
-e mysql
Expand All @@ -32,24 +23,25 @@ extras=(
-e trino
-e visualization
-e decompiler
-e deltalake
)
template="conda-lock/{platform}-${python_version}.lock"

function conda_lock() {
local platforms
platforms=(--platform "$1" --platform "$2")
shift 2
conda lock \
--file pyproject.toml \
--file "${python_version_file}" \
--kind explicit \
"${platforms[@]}" \
--filename-template "${template}" \
--filter-extras \
--conda="$(which conda)" \
--category dev --category test --category docs \
"${@}"
}
# directory of this script
top="$(dirname "$(readlink -f -- "$0")")"

python_version="${1}"
shift 1

conda_lock linux-64 osx-64 "${extras[@]}" -e datafusion
conda_lock osx-arm64 win-64 "${extras[@]}"
conda lock \
--file pyproject.toml \
--file "${top}/versions/python-${python_version}.yml" \
--channel conda-forge \
--platform linux-64 \
--platform osx-64 \
--platform osx-arm64 \
--platform win-64 \
--filter-extras \
--mamba \
--category dev --category test --category docs \
"${extras[@]}" \
"${@}"
Loading