Skip to content

Commit 1eaa618

Browse files
authored
CI: Use uv (#46)
1 parent 0d795cb commit 1eaa618

File tree

3 files changed

+16
-28
lines changed

3 files changed

+16
-28
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: Tests
22

3-
on:
3+
on:
44
schedule:
55
- cron: '42 8 2-30/2 * *' # At 08:42 UTC on every 2nd day-of-month
66
push:
77
pull_request:
8+
workflow_dispatch:
89

910
jobs:
1011
tests:
@@ -20,13 +21,10 @@ jobs:
2021
- uses: actions/checkout@v4
2122

2223
- name: Setup Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v5
24+
uses: astral-sh/setup-uv@v5
2425
with:
2526
python-version: ${{ matrix.python-version }}
2627

27-
- name: Update pip
28-
run: python -m pip install --upgrade pip
29-
3028
- name: Install MinGW-w64 tools (Windows)
3129
if: runner.os == 'Windows'
3230
uses: msys2/setup-msys2@v2
@@ -44,25 +42,10 @@ jobs:
4442
uses: fortran-lang/setup-fortran@v1
4543
with:
4644
compiler: gcc
47-
version: 11
48-
49-
- name: Install build dependencies (macOS)
50-
if: runner.os == 'macOS'
51-
run: |
52-
pip install meson ninja pandas numpy matplotlib pyemu flopy jupyter notebook nbconvert
53-
54-
- name: Install build dependencies (macOS)
55-
if: runner.os == 'Windows'
56-
run: |
57-
pip install meson ninja pandas numpy matplotlib pyemu flopy jupyter notebook nbconvert
58-
45+
version: 13
5946

60-
- name: Install build dependencies (Linux)
61-
if: runner.os == 'Linux'
62-
run: |
63-
sudo apt-get update
64-
sudo apt-get install -y gfortran
65-
pip install meson ninja pandas numpy matplotlib pyemu flopy jupyter notebook nbconvert
47+
- name: Install build requirements
48+
run: uv pip install meson ninja
6649

6750
- name: Build pestutils (Windows)
6851
if: runner.os == 'Windows'
@@ -75,10 +58,10 @@ jobs:
7558
if: runner.os != 'Windows'
7659
run: bash scripts/build_lib.sh
7760

78-
- name: Install package
79-
run: pip install .[test,optional]
61+
- name: Install package and all extras
62+
run: uv sync --all-extras
8063

8164
- name: Run tests
82-
run: pytest -v
65+
run: uv run pytest -v
8366
env:
8467
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ dependencies = [
3939
[project.optional-dependencies]
4040
optional = [
4141
"flopy",
42+
"jupyter",
4243
"pyemu",
4344
]
4445
test = [

tests/test_notebooks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
from pathlib import Path
44
from subprocess import run
55

6-
import nbformat
76
import pytest
87

8+
try:
9+
import nbformat
10+
except ImportError:
11+
pytest.skip("requires nbformat", allow_module_level=True)
12+
913
examples_dir = Path(__file__).parent.parent / "examples"
1014

1115

@@ -15,7 +19,7 @@ def test_notebooks(nb_file):
1519
nb = nbformat.read(f, as_version=4)
1620
for cell in nb["cells"]:
1721
for line in cell["source"].splitlines():
18-
if line.startswith("import "):
22+
if line.startswith("import ") and "ppu_helpers" not in line:
1923
module = line.split()[1]
2024
pytest.importorskip(module)
2125

0 commit comments

Comments
 (0)