Skip to content

Commit 6b2d06c

Browse files
Fixes CI: gallery bundle as optional, adds gallery build step, and updates TypeVar syntax
Makes gallery bundle copy a warning instead of an error when the bundle is not built, adds gallery build to CI test job, and updates stratification.py to PEP 695 type parameter syntax (fixes UP047).
1 parent 66a4ce2 commit 6b2d06c

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ jobs:
199199

200200
- name: Build TypeScript
201201
working-directory: bead/deployment/jspsych
202-
run: pnpm build
202+
run: pnpm build && pnpm build:gallery
203203

204204
- name: Set up Python
205205
uses: actions/setup-python@v5

bead/deployment/jspsych/generator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import json
1010
import re
11+
import warnings
1112
from pathlib import Path
1213
from uuid import UUID
1314

@@ -437,10 +438,13 @@ def _copy_gallery_bundle(self) -> None:
437438
output_path = self.output_dir / "js" / "gallery-bundle.js"
438439

439440
if not dist_path.exists():
440-
raise FileNotFoundError(
441+
warnings.warn(
441442
f"gallery-bundle.global.js not found at {dist_path}. "
442-
f"Run 'npm run build:gallery' in the jspsych directory."
443+
f"Bead plugins will not be available in the experiment. "
444+
f"Run 'npm run build:gallery' in the jspsych directory.",
445+
stacklevel=2,
443446
)
447+
return
444448

445449
try:
446450
output_path.write_text(dist_path.read_text())

bead/lists/stratification.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88

99
from collections import defaultdict
1010
from collections.abc import Callable, Hashable
11-
from typing import Any, TypeVar
11+
from typing import Any
1212
from uuid import UUID
1313

1414
import numpy as np
1515

1616
from bead.items.item import MetadataValue
1717

18-
T = TypeVar("T")
1918

20-
21-
def assign_quantiles(
19+
def assign_quantiles[T](
2220
items: list[T],
2321
property_getter: Callable[[T], float],
2422
n_quantiles: int = 10,
@@ -122,7 +120,7 @@ def assign_quantiles(
122120
return result
123121

124122

125-
def _assign_quantiles_single_group(
123+
def _assign_quantiles_single_group[T](
126124
items: list[T],
127125
property_getter: Callable[[T], float],
128126
n_quantiles: int,

0 commit comments

Comments
 (0)