Skip to content

Commit 2c6f251

Browse files
authored
Use uv and caching in CI (#4515)
1 parent 98ee6b4 commit 2c6f251

12 files changed

Lines changed: 128 additions & 91 deletions

.github/actions/build-test-environment/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ runs:
88
run: |
99
git config --global user.email "CI@example.com"
1010
git config --global user.name "CI Almighty"
11-
pip install tabulate # This produces summaries at the end
12-
pip install -e .[test,extractors,streaming_extractors,test_extractors,full]
11+
uv pip install --system tabulate # This produces summaries at the end
12+
uv pip install --system -e .[test,extractors,streaming_extractors,test_extractors,full]
1313
shell: bash
1414
- name: Install git-annex
1515
shell: bash
1616
run: |
17-
pip install datalad-installer
17+
uv pip install --system datalad-installer
1818
datalad-installer --sudo ok git-annex --method datalad/packages
1919
git config --global filter.annex.process "git-annex filter-process" # recommended for efficiency
2020
- name: Force installation of latest dev from key-packages when running dev (not release)
2121
run: |
2222
spikeinterface_is_dev_version=$(python -c "import spikeinterface; print(spikeinterface.DEV_MODE)")
2323
if [ $spikeinterface_is_dev_version = "True" ]; then
2424
echo "Running spikeinterface dev version"
25-
pip install --no-cache-dir git+https://github.com/NeuralEnsemble/python-neo
26-
pip install --no-cache-dir git+https://github.com/SpikeInterface/probeinterface
25+
uv pip install --system git+https://github.com/NeuralEnsemble/python-neo
26+
uv pip install --system git+https://github.com/SpikeInterface/probeinterface
2727
fi
2828
echo "Running tests for release, using pyproject.toml versions of neo and probeinterface"
2929
shell: bash

.github/workflows/all-tests.yml

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ jobs:
2929
steps:
3030
- uses: actions/checkout@v4
3131
- name: Setup Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v5
32+
uses: actions/setup-python@v6
3333
with:
3434
python-version: ${{ matrix.python-version }}
35+
- uses: astral-sh/setup-uv@v7
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
enable-cache: true
3539

3640
- name: Free space
3741
if: runner.os == 'Linux'
@@ -83,20 +87,20 @@ jobs:
8387
8488
- name: Install packages
8589
run: |
86-
pip install -e .[test_core]
90+
uv pip install --system -e .[test_core]
8791
shell: bash
8892

8993
- name: Pip list
90-
run: pip list
94+
run: uv pip list --system
9195

9296
- name: Test core
9397
run: pytest -m "core"
9498
shell: bash
9599

96100
- name: Install Dependencies for Timing Display
97101
run: |
98-
pip install tabulate
99-
pip install pandas
102+
uv pip install --system tabulate
103+
uv pip install --system pandas
100104
shell: bash
101105

102106
- name: Get current hash (SHA) of the ephy_testing_data repo
@@ -117,7 +121,7 @@ jobs:
117121
shell: bash
118122
if: env.RUN_EXTRACTORS_TESTS == 'true' || env.RUN_PREPROCESSING_TESTS == 'true'
119123
run: |
120-
pip install datalad-installer
124+
uv pip install --system datalad-installer
121125
if [ ${{ runner.os }} = 'Linux' ]; then
122126
datalad-installer --sudo ok git-annex --method datalad/packages
123127
elif [ ${{ runner.os }} = 'macOS' ]; then
@@ -141,78 +145,78 @@ jobs:
141145
HDF5_PLUGIN_PATH: ${{ github.workspace }}/hdf5_plugin_path_maxwell
142146
if: env.RUN_EXTRACTORS_TESTS == 'true'
143147
run: |
144-
pip install -e .[extractors,streaming_extractors,test_extractors]
145-
pip list
148+
uv pip install --system -e .[extractors,streaming_extractors,test_extractors]
149+
uv pip list --system
146150
./.github/run_tests.sh "extractors and not streaming_extractors" --no-virtual-env
147151
148152
- name: Test streaming extractors
149153
shell: bash
150154
if: env.RUN_STREAMING_EXTRACTORS_TESTS == 'true'
151155
run: |
152-
pip install -e .[streaming_extractors,test_extractors]
153-
pip list
156+
uv pip install --system -e .[streaming_extractors,test_extractors]
157+
uv pip list --system
154158
./.github/run_tests.sh "streaming_extractors" --no-virtual-env
155159
156160
- name: Test preprocessing
157161
shell: bash
158162
if: env.RUN_PREPROCESSING_TESTS == 'true'
159163
run: |
160-
pip install -e .[preprocessing,test_preprocessing]
161-
pip list
164+
uv pip install --system -e .[preprocessing,test_preprocessing]
165+
uv pip list --system
162166
./.github/run_tests.sh "preprocessing and not deepinterpolation" --no-virtual-env
163167
164168
- name: Install remaining testing dependencies # TODO: Remove this step once we have better modularization
165169
shell: bash
166170
run: |
167-
pip install -e .[test]
168-
pip list
171+
uv pip install --system -e .[test]
172+
uv pip list --system
169173
170174
- name: Test postprocessing
171175
shell: bash
172176
if: env.RUN_POSTPROCESSING_TESTS == 'true'
173177
run: |
174-
pip install -e .[full]
175-
pip list
178+
uv pip install --system -e .[full]
179+
uv pip list --system
176180
./.github/run_tests.sh postprocessing --no-virtual-env
177181
178182
- name: Test metrics
179183
shell: bash
180184
if: env.RUN_METRICS_TESTS == 'true'
181185
run: |
182-
pip install -e .[metrics]
183-
pip list
186+
uv pip install --system -e .[metrics]
187+
uv pip list --system
184188
./.github/run_tests.sh metrics --no-virtual-env
185189
186190
- name: Test comparison
187191
shell: bash
188192
if: env.RUN_COMPARISON_TESTS == 'true'
189193
run: |
190-
pip install -e .[full]
191-
pip list
194+
uv pip install --system -e .[full]
195+
uv pip list --system
192196
./.github/run_tests.sh comparison --no-virtual-env
193197
194198
- name: Test core sorters
195199
shell: bash
196200
if: env.RUN_SORTERS_TESTS == 'true'
197201
run: |
198-
pip install -e .[full]
199-
pip list
202+
uv pip install --system -e .[full]
203+
uv pip list --system
200204
./.github/run_tests.sh sorters --no-virtual-env
201205
202206
- name: Test internal sorters
203207
shell: bash
204208
if: env.RUN_INTERNAL_SORTERS_TESTS == 'true'
205209
run: |
206-
pip install -e .[full]
207-
pip list
210+
uv pip install --system -e .[full]
211+
uv pip list --system
208212
./.github/run_tests.sh sorters_internal --no-virtual-env
209213
210214
- name: Test curation
211215
shell: bash
212216
if: env.RUN_CURATION_TESTS == 'true'
213217
run: |
214-
pip install -e .[full]
215-
pip list
218+
uv pip install --system -e .[full]
219+
uv pip list --system
216220
./.github/run_tests.sh curation --no-virtual-env
217221
218222
- name: Test widgets
@@ -221,24 +225,24 @@ jobs:
221225
env:
222226
KACHERY_ZONE: "scratch"
223227
run: |
224-
pip install -e .[full,widgets]
225-
pip list
228+
uv pip install --system -e .[full,widgets]
229+
uv pip list --system
226230
./.github/run_tests.sh widgets --no-virtual-env -s
227231
228232
- name: Test exporters
229233
shell: bash
230234
if: env.RUN_EXPORTERS_TESTS == 'true'
231235
run: |
232-
pip install -e .[full]
233-
pip list
236+
uv pip install --system -e .[full]
237+
uv pip list --system
234238
./.github/run_tests.sh exporters --no-virtual-env
235239
236240
- name: Test sortingcomponents
237241
shell: bash
238242
if: env.RUN_SORTINGCOMPONENTS_TESTS == 'true'
239243
run: |
240-
pip install -e .[full]
241-
pip list
244+
uv pip install --system -e .[full]
245+
uv pip list --system
242246
243247
# Internal shell check for platform and env var
244248
if [[ "$RUNNER_OS" == "macOS" ]]; then
@@ -258,6 +262,6 @@ jobs:
258262
shell: bash
259263
if: env.RUN_GENERATION_TESTS == 'true'
260264
run: |
261-
pip install -e .[full]
262-
pip list
265+
uv pip install --system -e .[full]
266+
uv pip list --system
263267
./.github/run_tests.sh generation --no-virtual-env

.github/workflows/caches_cron_job.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ jobs:
1717
matrix:
1818
os: [ubuntu-latest, macos-latest, windows-latest]
1919
steps:
20-
- uses: actions/setup-python@v5
20+
- uses: actions/setup-python@v6
2121
with:
2222
python-version: '3.11'
23+
- uses: astral-sh/setup-uv@v7
24+
with:
25+
python-version: '3.11'
26+
enable-cache: true
2327
- name: Create the directory to store the data
2428
run: |
2529
mkdir -p ~/spikeinterface_datasets/ephy_testing_data/
@@ -45,16 +49,15 @@ jobs:
4549
run: |
4650
git config --global user.email "CI@example.com"
4751
git config --global user.name "CI Almighty"
48-
python -m pip install -U pip # Official recommended way
49-
pip install datalad-installer
52+
uv pip install --system datalad-installer
5053
if [ ${{ runner.os }} == 'Linux' ]; then
5154
datalad-installer --sudo ok git-annex --method datalad/packages
5255
elif [ ${{ runner.os }} == 'macOS' ]; then
5356
datalad-installer --sudo ok git-annex --method brew
5457
elif [ ${{ runner.os }} == 'Windows' ]; then
5558
datalad-installer --sudo ok git-annex --method datalad/git-annex:release
5659
fi
57-
pip install datalad
60+
uv pip install --system datalad
5861
git config --global filter.annex.process "git-annex filter-process" # recommended for efficiency
5962
shell: bash
6063
- name: Download dataset

.github/workflows/core-test.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,26 @@ jobs:
2020
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
2121
steps:
2222
- uses: actions/checkout@v4
23-
- uses: actions/setup-python@v5
23+
- uses: actions/setup-python@v6
2424
with:
2525
python-version: '3.11'
26+
- uses: astral-sh/setup-uv@v7
27+
with:
28+
python-version: '3.11'
29+
enable-cache: true
2630
- name: Install dependencies
2731
run: |
2832
git config --global user.email "CI@example.com"
2933
git config --global user.name "CI Almighty"
30-
python -m pip install -U pip # Official recommended way
31-
pip install -e .[test_core]
34+
uv pip install --system -e .[test_core]
3235
- name: Test core with pytest
3336
run: |
3437
pytest -m "core" -vv -ra --durations=0 --durations-min=0.001 | tee report.txt; test $? -eq 0 || exit 1
3538
shell: bash # Necessary for pipeline to work on windows
3639
- name: Build test summary
3740
run: |
38-
pip install pandas
39-
pip install tabulate
41+
uv pip install --system pandas
42+
uv pip install --system tabulate
4043
echo "# Timing profile of core tests in ${{matrix.os}}" >> $GITHUB_STEP_SUMMARY
4144
# Outputs markdown summary to standard output
4245
python ./.github/scripts/build_job_summary.py report.txt >> $GITHUB_STEP_SUMMARY

.github/workflows/deepinterpolation.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ jobs:
2020
os: ["ubuntu-latest"]
2121
steps:
2222
- uses: actions/checkout@v4
23-
- uses: actions/setup-python@v5
23+
- uses: actions/setup-python@v6
2424
with:
2525
python-version: '3.10'
26+
- uses: astral-sh/setup-uv@v7
27+
with:
28+
python-version: '3.10'
29+
enable-cache: false
2630
- name: Get changed files
2731
id: changed-files
2832
uses: tj-actions/changed-files@v46.0.1
@@ -38,16 +42,15 @@ jobs:
3842
- name: Install dependencies
3943
if: ${{ steps.modules-changed.outputs.DEEPINTERPOLATION_CHANGED == 'true' }}
4044
run: |
41-
python -m pip install -U pip # Official recommended way
4245
# install deepinteprolation
43-
pip install tensorflow==2.8.4
44-
pip install deepinterpolation@git+https://github.com/AllenInstitute/deepinterpolation.git
45-
pip install numpy==1.26.4
46-
pip install -e .[full,test_core]
46+
uv pip install --system tensorflow==2.8.4
47+
uv pip install --system deepinterpolation@git+https://github.com/AllenInstitute/deepinterpolation.git
48+
uv pip install --system numpy==1.26.4
49+
uv pip install --system -e .[full,test_core]
4750
- name: Pip list
4851
if: ${{ steps.modules-changed.outputs.DEEPINTERPOLATION_CHANGED == 'true' }}
4952
run: |
50-
pip list
53+
uv pip list --system
5154
- name: Test DeepInterpolation with pytest
5255
if: ${{ steps.modules-changed.outputs.DEEPINTERPOLATION_CHANGED == 'true' }}
5356
run: |

.github/workflows/full-test-with-codecov.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ jobs:
2020
os: ["ubuntu-latest", ]
2121
steps:
2222
- uses: actions/checkout@v4
23-
- uses: actions/setup-python@v5
23+
- uses: actions/setup-python@v6
2424
with:
2525
python-version: '3.12'
26+
- uses: astral-sh/setup-uv@v7
27+
with:
28+
python-version: '3.12'
29+
enable-cache: true
2630
- name: Free space
2731
run: |
2832
sudo rm -rf /usr/local/lib/android
@@ -50,7 +54,7 @@ jobs:
5054
- name: Install packages
5155
uses: ./.github/actions/build-test-environment
5256
- name: Pip list
53-
run: pip list
57+
run: uv pip list --system
5458
- name: run tests
5559
env:
5660
HDF5_PLUGIN_PATH: ${{ github.workspace }}/hdf5_plugin_path_maxwell

.github/workflows/installation-tips-test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
schedule:
66
- cron: "0 12 * * 0" # Weekly at noon UTC on Sundays
77

8-
env:
9-
UV_SYSTEM_PYTHON: 1
10-
118
jobs:
129
installation-tips-testing:
1310
name: Test uv installation on ${{ matrix.os }} OS
@@ -21,14 +18,17 @@ jobs:
2118
- os: windows-latest
2219
steps:
2320
- uses: actions/checkout@v4
24-
- uses: actions/setup-python@v5
21+
- uses: actions/setup-python@v6
2522
with:
2623
python-version: '3.12'
2724
- name: Install uv
28-
uses: astral-sh/setup-uv@v6
25+
uses: astral-sh/setup-uv@v7
26+
with:
27+
python-version: '3.12'
28+
enable-cache: true
2929

3030
- name: Install requirements
31-
run: uv pip install -r ./installation_tips/beginner_requirements_stable.txt
31+
run: uv pip install --system -r ./installation_tips/beginner_requirements_stable.txt
3232
- name: Check Installation Tips (mac)
3333
if: ${{ matrix.os == 'macos-latest' }}
3434
run: python ./installation_tips/check_your_install.py --ci --short --skip-kilosort4 # ci flag turns off gui

.github/workflows/publish-to-pypi.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515
- name: Set up Python
16-
uses: actions/setup-python@v5
16+
uses: actions/setup-python@v6
1717
with:
1818
python-version: '3.12'
19+
- uses: astral-sh/setup-uv@v7
20+
with:
21+
python-version: '3.12'
22+
enable-cache: true
1923
- name: Install dependencies for testing
2024
run: |
21-
python -m pip install -U pip # Official recommended way
22-
pip install pytest
23-
pip install zarr
24-
pip install setuptools wheel twine build
25-
pip install -e .[test_core]
25+
uv pip install --system pytest
26+
uv pip install --system zarr
27+
uv pip install --system setuptools wheel twine build
28+
uv pip install --system -e .[test_core]
2629
- name: Test core with pytest
2730
run: |
2831
pytest -v src/spikeinterface/core

0 commit comments

Comments
 (0)