Skip to content

Commit c2940f1

Browse files
cpcloudgforsyth
authored andcommitted
build: move to unified lockfile
1 parent a35a756 commit c2940f1

27 files changed

+72193
-5259
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
conda-lock/*.lock linguist-generated=true
1+
ci/conda-lock/python-*.yml linguist-generated=true
22
flake.lock linguist-generated=true
33
poetry.lock linguist-generated=true
44
requirements.txt linguist-generated=true

.github/workflows/conda-lock.yml

+9-61
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,27 @@ jobs:
2727

2828
- uses: conda-incubator/setup-miniconda@v2
2929
with:
30-
miniconda-version: latest
30+
miniforge-variant: Mambaforge
31+
miniforge-version: latest
3132
activate-environment: conda-lock
32-
channels: conda-forge
33-
channel-priority: strict
3433
python-version: "3.11"
3534
condarc-file: ci/conda-lock/condarc
35+
use-mamba: true
3636

3737
- name: install conda libmamba solver
38-
run: conda install -n base conda-libmamba-solver
39-
40-
- name: set solver to libmamba
41-
run: conda config --set solver libmamba
42-
43-
- name: install conda-lock
44-
run: conda install conda-lock=1.4
38+
run: mamba install --name base conda-lock=2.3
4539

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

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

5246
- name: upload conda lock files
5347
uses: actions/upload-artifact@v3
5448
with:
5549
name: conda-lock-files-${{ github.run_attempt }}
56-
path: conda-lock/*-${{ matrix.python-version }}.lock
50+
path: ci/conda-lock/python-*.yml
5751

5852
condalock_pr:
5953
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
@@ -81,7 +75,7 @@ jobs:
8175
uses: actions/download-artifact@v3
8276
with:
8377
name: conda-lock-files-${{ github.run_attempt }}
84-
path: conda-lock
78+
path: ci/conda-lock
8579

8680
- uses: peter-evans/create-pull-request@v5
8781
id: create_pr
@@ -90,7 +84,7 @@ jobs:
9084
commit-message: "chore(conda-lock): relock"
9185
branch: "create-pull-request/conda-relock"
9286
delete-branch: true
93-
add-paths: conda-lock/*.lock
87+
add-paths: ci/conda-lock/python-*.yml
9488
committer: "ibis-squawk-bot[bot] <ibis-squawk-bot[bot]@users.noreply.github.com>"
9589
author: "ibis-squawk-bot[bot] <ibis-squawk-bot[bot]@users.noreply.github.com>"
9690
title: "chore(conda-lock): relock"
@@ -110,49 +104,3 @@ jobs:
110104
token: ${{ steps.generate_pr_token.outputs.token }}
111105
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }}
112106
merge-method: rebase
113-
114-
condalock_push:
115-
if: github.event_name == 'repository_dispatch'
116-
runs-on: ubuntu-latest
117-
needs:
118-
- condalock
119-
steps:
120-
- uses: tibdex/github-app-token@v2
121-
id: generate_token
122-
with:
123-
app_id: ${{ secrets.SQUAWK_BOT_APP_ID }}
124-
private_key: ${{ secrets.SQUAWK_BOT_APP_PRIVATE_KEY }}
125-
126-
- uses: actions/checkout@v4
127-
with:
128-
token: ${{ steps.generate_token.outputs.token }}
129-
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
130-
ref: ${{ github.event.client_payload.pull_request.head.ref }}
131-
132-
- name: download conda lock files
133-
uses: actions/download-artifact@v3
134-
with:
135-
name: conda-lock-files-${{ github.run_attempt }}
136-
path: conda-lock
137-
138-
- name: Configure git info
139-
run: |
140-
set -euo pipefail
141-
142-
git config --global user.name 'ibis-squawk-bot[bot]'
143-
git config --global user.email 'ibis-squawk-bot[bot]@users.noreply.github.com'
144-
145-
- name: commit lock files and push to PR
146-
run: |
147-
set -euo pipefail
148-
149-
git add conda-lock/*.lock
150-
151-
if git commit -m 'chore(conda-lock): relock'; then
152-
# pull in case another commit happened in the meantime
153-
#
154-
# `ours` is actually the *other* changeset, not the current branch, per
155-
# https://stackoverflow.com/a/3443225/564538
156-
git pull --rebase -s recursive -X ours
157-
git push
158-
fi

.pre-commit-config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ repos:
5656
rev: v4.5.0
5757
hooks:
5858
- id: check-added-large-files
59-
args: ["--maxkb=700"]
59+
args: ["--maxkb=710"]
6060
- id: check-case-conflict
6161
- id: check-executables-have-shebangs
6262
- id: check-merge-conflict
@@ -89,6 +89,7 @@ repos:
8989
- json
9090
- markdown
9191
- yaml
92+
exclude: ci/conda-lock/python-.+\.yml
9293
- id: taplo
9394
name: taplo
9495
language: system

.yamllint.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ extends: default
33

44
ignore:
55
- docs/_publish.yml
6+
- ci/conda-lock/python-*.yml
67

78
rules:
89
document-start: disable

ci/conda-lock/condarc

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ channels:
33
- conda-forge
44
channel_priority: strict
55

6+
# use mamba for SAT solving
7+
solver: libmamba
8+
69
always_yes: true
710

811
# remote_connect_timeout_secs (float)

ci/conda-lock/generate.sh

+21-29
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,14 @@
22

33
set -euo pipefail
44

5-
python_version="${1}"
6-
python_version_file="$(mktemp --suffix=.yml)"
7-
8-
{
9-
echo 'name: conda-lock'
10-
echo 'dependencies:'
11-
echo " - python=${python_version}"
12-
} > "${python_version_file}"
13-
145
extras=(
156
-e bigquery
167
-e clickhouse
178
-e dask
9+
-e datafusion
1810
-e druid
1911
-e duckdb
20-
# this doesn't work on any platform yet (issues with resolving some google deps)
21-
# -e geospatial
12+
-e geospatial
2213
-e impala
2314
-e mssql
2415
-e mysql
@@ -32,24 +23,25 @@ extras=(
3223
-e trino
3324
-e visualization
3425
-e decompiler
26+
-e deltalake
3527
)
36-
template="conda-lock/{platform}-${python_version}.lock"
3728

38-
function conda_lock() {
39-
local platforms
40-
platforms=(--platform "$1" --platform "$2")
41-
shift 2
42-
conda lock \
43-
--file pyproject.toml \
44-
--file "${python_version_file}" \
45-
--kind explicit \
46-
"${platforms[@]}" \
47-
--filename-template "${template}" \
48-
--filter-extras \
49-
--conda="$(which conda)" \
50-
--category dev --category test --category docs \
51-
"${@}"
52-
}
29+
# directory of this script
30+
top="$(dirname "$(readlink -f -- "$0")")"
31+
32+
python_version="${1}"
33+
shift 1
5334

54-
conda_lock linux-64 osx-64 "${extras[@]}" -e datafusion
55-
conda_lock osx-arm64 win-64 "${extras[@]}"
35+
conda lock \
36+
--file pyproject.toml \
37+
--file "${top}/versions/python-${python_version}.yml" \
38+
--channel conda-forge \
39+
--platform linux-64 \
40+
--platform osx-64 \
41+
--platform osx-arm64 \
42+
--platform win-64 \
43+
--filter-extras \
44+
--mamba \
45+
--category dev --category test --category docs \
46+
"${extras[@]}" \
47+
"${@}"

0 commit comments

Comments
 (0)