Skip to content

Commit 082dad5

Browse files
committed
enh: improve handling of indices
* discover indices available from what idc-index-data bundles * initialize index cache at the time idc-index package is created * fetch schema of the extra indices along with the index itself Co-authored with Copilot
1 parent 4262b4c commit 082dad5

File tree

8 files changed

+742
-32
lines changed

8 files changed

+742
-32
lines changed

.github/workflows/cd.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,38 @@ jobs:
2727
with:
2828
fetch-depth: 0
2929

30+
- uses: actions/setup-python@v5
31+
with:
32+
python-version: "3.x"
33+
34+
- name: Read idc-index-data version from pyproject.toml
35+
run: |
36+
python - <<'PY' > /tmp/idc_ver.env
37+
import tomllib, re
38+
with open('pyproject.toml','rb') as f:
39+
data = tomllib.load(f)
40+
ver = None
41+
for d in data['project']['dependencies']:
42+
m = re.match(r'idc-index-data==(.+)', d)
43+
if m:
44+
ver = m.group(1)
45+
break
46+
assert ver, 'idc-index-data version not found in pyproject.toml'
47+
print(f'IDC_INDEX_DATA_VERSION={ver}')
48+
PY
49+
cat /tmp/idc_ver.env >> $GITHUB_ENV
50+
51+
- name: Preinstall idc-index-data for cache generation
52+
env:
53+
IDC_INDEX_DATA_VERSION: ${{ env.IDC_INDEX_DATA_VERSION }}
54+
run: |
55+
python -m pip install --upgrade pip
56+
python -m pip install "idc-index-data==${IDC_INDEX_DATA_VERSION}"
57+
58+
- name: Generate bundled indices cache
59+
run: |
60+
python scripts/generate_indices_cache.py
61+
3062
- uses: hynek/build-and-inspect-python-package@v2
3163

3264
publish:

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,34 @@ jobs:
5353
python-version: ${{ matrix.python-version }}
5454
allow-prereleases: true
5555

56+
- name: Read idc-index-data version from pyproject.toml
57+
run: |
58+
python - <<'PY' > /tmp/idc_ver.env
59+
import tomllib, re
60+
with open('pyproject.toml','rb') as f:
61+
data = tomllib.load(f)
62+
ver = None
63+
for d in data['project']['dependencies']:
64+
m = re.match(r'idc-index-data==(.+)', d)
65+
if m:
66+
ver = m.group(1)
67+
break
68+
assert ver, 'idc-index-data version not found in pyproject.toml'
69+
print(f'IDC_INDEX_DATA_VERSION={ver}')
70+
PY
71+
cat /tmp/idc_ver.env >> $GITHUB_ENV
72+
73+
- name: Preinstall idc-index-data for cache generation
74+
env:
75+
IDC_INDEX_DATA_VERSION: ${{ env.IDC_INDEX_DATA_VERSION }}
76+
run: |
77+
python -m pip install --upgrade pip
78+
python -m pip install "idc-index-data==${IDC_INDEX_DATA_VERSION}"
79+
80+
- name: Generate bundled indices cache
81+
run: |
82+
python scripts/generate_indices_cache.py
83+
5684
- name: Install package
5785
run: python -m pip install .[test]
5886

0 commit comments

Comments
 (0)