Skip to content

Commit 9bafe3a

Browse files
authored
Switch CI to use uv (#64)
uv is significantly faster at installing python dependencies. not that simweights was particularly slow, but the total speedup is about a factor of 3 which makes getting feedback on better. Also move docs builds to tests because it is convenient
1 parent 6dddc2c commit 9bafe3a

File tree

3 files changed

+47
-55
lines changed

3 files changed

+47
-55
lines changed

.github/workflows/docs.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,33 @@ concurrency:
1212
cancel-in-progress: true
1313
jobs:
1414
Tests:
15+
env:
16+
UV_SYSTEM_PYTHON: 1
1517
runs-on: ${{ matrix.os }}
1618
strategy:
1719
fail-fast: false
1820
matrix:
19-
python-version: ["3.9", "3.10", "3.11", "3.12"]
21+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2022
os: [ubuntu-24.04]
2123
include:
2224
- python-version: "3.13"
23-
os: macos-latest
25+
os: macos-13
26+
- python-version: "3.13"
27+
os: macos-14
28+
- python-version: "3.13"
29+
os: macos-15
2430
steps:
2531
- uses: actions/checkout@v4
2632
- name: Set up Python ${{ matrix.python-version }}
2733
uses: actions/setup-python@v5
2834
with:
2935
python-version: ${{ matrix.python-version }}
30-
cache: pip
31-
cache-dependency-path: pyproject.toml
36+
- name: Install uv and set the python version
37+
uses: astral-sh/setup-uv@v6
38+
with:
39+
enable-cache: true
3240
- name: Install SimWeights
33-
run: |
34-
if [ "${{matrix.python-version}}" != "3.13" ]; then
35-
python3 -m pip install nuflux
36-
fi
37-
python3 -m pip install flit
38-
python3 -m flit install --symlink --deps=production --extras=test
41+
run: uv pip install -e .[test]
3942
- name: Download Test Data
4043
run: |
4144
curl -u icecube:${{ secrets.ICECUBE_PASSWORD }} https://convey.icecube.wisc.edu/data/ana/Software/simweights/test-data/simweights_testdata.tar.gz -O
@@ -60,14 +63,20 @@ jobs:
6063
fail_ci_if_error: false
6164
verbose: true
6265
TestsIceTray:
66+
env:
67+
UV_SYSTEM_PYTHON: 1
6368
runs-on: ubuntu-latest
6469
container: icecube/icetray:icetray-devel-current-ubuntu22.04-X64
6570
strategy:
6671
fail-fast: false
6772
steps:
6873
- uses: actions/checkout@v4
74+
- name: Install uv
75+
uses: astral-sh/setup-uv@v6
76+
with:
77+
enable-cache: true
6978
- name: Install SimWeights
70-
run: python3 -m pip install 'pytest>7' .[test]
79+
run: uv pip install -e .[test]
7180
- name: Download Test Data
7281
run: |
7382
curl -u icecube:${{ secrets.ICECUBE_PASSWORD }} https://convey.icecube.wisc.edu/data/ana/Software/simweights/test-data/simweights_testdata.tar.gz -O
@@ -104,3 +113,29 @@ jobs:
104113
with:
105114
files: "*.xml"
106115
deduplicate_classes_by_file_name: true
116+
Docs:
117+
env:
118+
UV_SYSTEM_PYTHON: 1
119+
runs-on: ubuntu-24.04
120+
steps:
121+
- uses: actions/checkout@v4
122+
- name: Set up Python ${{ matrix.python-version }}
123+
uses: actions/setup-python@v5
124+
with:
125+
python-version: "3.13"
126+
- name: Install uv
127+
uses: astral-sh/setup-uv@v6
128+
with:
129+
enable-cache: true
130+
- name: Install dependencies
131+
run: |
132+
uv pip install .[docs]
133+
- name: Run Sphinx
134+
working-directory: ./docs
135+
run: make html
136+
- name: Upload docs to docs.icecube.aq
137+
if: ${{ github.ref_name == 'main' && !github.event.act }}
138+
working-directory: ./docs
139+
run: |
140+
tar -czvf simweights_docs.tar.gz -C_build/html .
141+
curl -XPUT -i --data-binary @simweights_docs.tar.gz https://docs.icecube.aq/api/upload?path=simweights/${{ github.ref_name }} -u icecube:${{ secrets.ICECUBE_PASSWORD }}

tests/test_weighter.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44
#
55
# SPDX-License-Identifier: BSD-2-Clause
66

7-
import contextlib
87
import unittest
98
from copy import deepcopy
109

1110
import numpy as np
1211

1312
from simweights import TIG1996, IceTopSurface, NaturalRateCylinder, NuGenSurface, PowerLaw, Weighter
1413

15-
with contextlib.suppress(ImportError):
16-
import nuflux
17-
1814

1915
def fluxfun1(energy):
2016
return energy**2
@@ -315,7 +311,7 @@ def test_nuflux(self):
315311
weighter1.add_weight_column("energy", data1["I3Weight"]["energy"])
316312
weighter1.add_weight_column("cos_zen", np.cos(data1["I3Weight"]["zenith"]))
317313

318-
honda = nuflux.makeFlux("honda2006")
314+
honda = nuflux.makeFlux("honda2006") # noqa : F821
319315
w = weighter1.get_weights(honda)
320316
fluxval = honda.getFlux(14, data1["I3Weight"]["energy"], np.cos(data1["I3Weight"]["zenith"]))
321317
oneweight = weighter1.get_weights(1)

0 commit comments

Comments
 (0)