Skip to content

Commit b0e8411

Browse files
committed
Navigate to model pages from GitHub activity scatter plot (#316)
* Bump pre-commit hooks and site dependencies - ruff v0.14.13 -> v0.14.14 - eslint v10.0.0-rc.0 -> v10.0.0-rc.2 - check-jsonschema 0.36.0 -> 0.36.1 - typos v1.42.0 -> v1.42.3 - svelte 5.47.0 -> 5.49.1 - svelte-check -> svelte-check-rs 0.7.3 - matterviz 0.2.2 -> 0.2.3 - vitest 4.0.17 -> 4.0.18 - typescript-eslint 8.53.0 -> 8.54.0 * Remove unnecessary type: ignore comments - SevenNetCalculator kwargs typing fixed upstream - mace_calc.models typing fixed - pmv.structure_3d typing fixed - FrechetCellFilter typing fixed - PET calculator compute_energy typing fixed * Replace abc.abstractmethod with NotImplementedError in Files enum Files base class can't use abc.abstractmethod since it uses a custom metaclass (MetaFiles), not ABCMeta. Replace with explicit NotImplementedError to enforce implementation in subclasses. - Remove abc import from enums.py - Add type annotation to energy.py dict access - Update test SubFiles to implement url/label properties * Navigate to model pages from GitHub activity scatter plot and set color scale to log Add model_key field to GitHub activity data to enable direct navigation to model detail pages when clicking points in the scatter plot. - fetch-mlip-repos-github-activity.ts: Extract model_key from YAML, skip superseded/aborted models, update cache with current model info - GitHubActivityScatter.svelte: Use goto() to navigate to /models/{slug}, add color_scale prop, fix GitHubMetricKey type to exclude model_key, improve tooltip null checks - types.ts: Add model_key to GitHubActivityData type - TableControls.svelte: Remove obsolete ts-expect-error, fix Label type - Regenerate mlip-github-activity.json with model_key fields Cleanup site routes and tests - +error.svelte: Add light theme filter for images - +layout.svelte: Simplify heading selector, remove redundant CSS, adjust breakpoint and nav styling - +page.svelte: Consolidate matterviz imports - data/+page.svelte: Add types to snapshot restore - models/+page.svelte: Add types to snapshot restore, consolidate imports - test_fetch.py: Fix iter_content mock signature (add decode_unicode) DRY improvements across codebase - test_fetch.py: Extract make_mock_response() helper (removes 3x duplication) - fetch-mlip-repos-github-activity.ts: Extract is_cache_fresh() helper, use update_info() for consistent object spreading - GitHubActivityScatter.svelte: Extract format string constant, consolidate point_label object to single line - data/+page.svelte, models/+page.svelte: Use ReturnType<typeof capture_state> to infer snapshot restore type instead of manual duplication * Fix svelte-check warnings and TypeScript errors - Fix a11y heading hierarchy: change h3 to h2 in phonons, discovery, model pages - Fix RadarChart a11y: add role="button", keyboard handler, tabindex for interactive SVG - Fix +error.svelte type narrowing: use !online instead of online === false - Fix api/+page.svelte: add typed import.meta.glob for markdown modules - Simplify GitHubActivityScatter tooltip type assertion - Update table-export tests with proper html-to-image mocking * Fix test failures after heading hierarchy changes - Update PhononsPage test to expect h2 instead of h3 - Remove vi.resetModules() from table-export tests (interferes with vi.mock) Make h2 assertion resilient to additional headings Fix table-export test isolation issues - Add async beforeEach to re-establish html-to-image mocks after clearAllMocks - Use vi.restoreAllMocks() in afterEach to ensure clean spy state between tests - Fix mock leakage between parameterized test iterations Fix RadarChart keyboard handler to use proper coordinates - Extract move_to_position helper for shared click/keyboard logic - Add handle_keyboard_click that moves to SVG center (equal weights) - Fixes NaN coordinates from casting KeyboardEvent to MouseEvent
1 parent 2f85048 commit b0e8411

34 files changed

+384
-269
lines changed

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,4 @@ jobs:
1919
uv-version: latest
2020
deno-version: 2.3.7 # https://github.com/pngwn/MDsveX/issues/743
2121
working-directory: site
22-
pre-build: |
23-
uv run --with-editable .. ../scripts/make_api_docs.py
24-
git clone --depth 1 https://github.com/janosh/matterviz ../matterviz
25-
(cd ../matterviz && deno install && deno run -A npm:@sveltejs/kit sync && deno task package)
26-
rm -rf node_modules/.deno/matterviz* node_modules/matterviz
27-
ln -s ../../matterviz node_modules/matterviz
22+
pre-build: uv run --with-editable .. ../scripts/make_api_docs.py

.github/workflows/test.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ jobs:
4141
working-directory: site
4242
test-cmd: npx vitest run
4343
deno-version: 2.3.7 # https://github.com/denoland/deno/issues/29968
44-
install-cmd: |
45-
git clone --depth 1 https://github.com/janosh/matterviz ../matterviz
46-
(cd ../matterviz && deno install && deno run -A npm:@sveltejs/kit sync && deno task package)
47-
deno install
48-
rm -rf node_modules/.deno/matterviz* node_modules/matterviz
49-
ln -s ../../matterviz node_modules/matterviz
5044

5145
scripts:
5246
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default_install_hook_types: [pre-commit, commit-msg]
44

55
repos:
66
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: v0.14.13
7+
rev: v0.14.14
88
hooks:
99
- id: ruff-check
1010
args: [--fix]
@@ -82,7 +82,7 @@ repos:
8282
exclude: changelog\.md$
8383

8484
- repo: https://github.com/pre-commit/mirrors-eslint
85-
rev: v10.0.0-rc.0
85+
rev: v10.0.0-rc.2
8686
hooks:
8787
- id: eslint
8888
types: [file]
@@ -97,7 +97,7 @@ repos:
9797
- '@stylistic/eslint-plugin'
9898

9999
- repo: https://github.com/python-jsonschema/check-jsonschema
100-
rev: 0.36.0
100+
rev: 0.36.1
101101
hooks:
102102
- id: check-jsonschema
103103
files: ^models/.+/.+\.yml$
@@ -108,7 +108,7 @@ repos:
108108
- id: check-github-actions
109109

110110
- repo: https://github.com/crate-ci/typos
111-
rev: v1.42.0
111+
rev: v1.42.3
112112
hooks:
113113
- id: typos
114114
types: [text]

matbench_discovery/energy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def calc_energy_from_e_refs(
112112
ValueError: If missing reference energies for some elements
113113
"""
114114
if isinstance(struct_or_entry, dict): # entry dict case
115-
energy = struct_or_entry["energy"]
115+
energy: float = struct_or_entry["energy"]
116116
comp = Composition(struct_or_entry["composition"])
117117
# Entry/ComputedEntry/ComputedStructureEntry instance case
118118
elif isinstance(struct_or_entry, Entry):

matbench_discovery/enums.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Enums used as keys/accessors for dicts and dataframes across Matbench Discovery."""
22

3-
import abc
43
import builtins
54
import functools
65
import os
@@ -232,14 +231,18 @@ def __str__(self) -> str:
232231
return self.name
233232

234233
@property
235-
@abc.abstractmethod
236234
def url(self) -> str:
237235
"""URL associated with the file."""
236+
raise NotImplementedError(
237+
f"{type(self).__name__} must implement 'url' property"
238+
)
238239

239240
@property
240-
@abc.abstractmethod
241241
def label(self) -> str:
242242
"""Label associated with the file."""
243+
raise NotImplementedError(
244+
f"{type(self).__name__} must implement 'label' property"
245+
)
243246

244247
@property
245248
def rel_path(self) -> str:

models/eqV2/test_fairchem_discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def _ase_relax(
164164

165165
filtered_atoms = atoms if filter_cls is None else filter_cls(atoms)
166166
optim_inst = optim_cls(
167-
filtered_atoms, # type: ignore[arg-type]
167+
filtered_atoms,
168168
logfile=None,
169169
**optimizer_params,
170170
)

models/mace/test_mace_discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
"force_max": force_max,
113113
"ase_optimizer": ase_optimizer,
114114
"device": device,
115-
Key.model_params: count_parameters(mace_calc.models[0]), # type: ignore[arg-type]
115+
Key.model_params: count_parameters(mace_calc.models[0]),
116116
"model_name": model_name,
117117
"dtype": dtype,
118118
"cell_filter": "FrechetCellFilter",

models/pet/thermal_conductivity.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ def calculate_fc2_set(
9494
)
9595
for supercell in batch_displacements
9696
]
97-
res = calculator.compute_energy( # type: ignore[attr-defined]
98-
batch_atoms, compute_forces_and_stresses=True
99-
)
97+
res = calculator.compute_energy(batch_atoms, compute_forces_and_stresses=True)
10098
f = res["forces"]
10199
forces.extend(f)
102100

@@ -144,9 +142,7 @@ def calculate_fc3_set(
144142
)
145143
for supercell in batch_displacements
146144
]
147-
res = calculator.compute_energy( # type: ignore[attr-defined]
148-
batch_atoms, compute_forces_and_stresses=True
149-
)
145+
res = calculator.compute_energy(batch_atoms, compute_forces_and_stresses=True)
150146
f = res["forces"]
151147
forces.extend(f)
152148

models/sevennet/test_sevennet_diatomics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
calc_kwargs["model"] = str(checkpoint_path)
5959

6060
dtype = "float32"
61-
calculator = SevenNetCalculator(**calc_kwargs) # type: ignore[arg-type]
61+
calculator = SevenNetCalculator(**calc_kwargs)
6262

6363
json_path = f"{ROOT}/models/{model_name}/{model_variant}/{today}-diatomics.json.gz"
6464
existing_paths = glob(json_path.replace(today, "*-*-*"))

models/sevennet/test_sevennet_discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
print(f"{data_path=}", flush=True)
9494

9595
# Initialize ASE SevenNet Calculator from checkpoint
96-
seven_net_calc = SevenNetCalculator(**calc_kwargs) # type: ignore[arg-type]
96+
seven_net_calc = SevenNetCalculator(**calc_kwargs)
9797

9898

9999
# %%

0 commit comments

Comments
 (0)