Skip to content

Commit cc08c78

Browse files
committed
bump @rollup/plugin-yaml to v4.1 and refactor citation.cff import using new extensions option
1 parent ad9d8aa commit cc08c78

14 files changed

+28
-31
lines changed

models/bowsr/test_bowsr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363

6464
# %%
65-
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", 0))
65+
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", "0"))
6666
out_path = f"{out_dir}/bowsr-preds-{slurm_array_task_id}.json.gz"
6767

6868
if os.path.isfile(out_path):

models/cgcnn/train_cgcnn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
learning_rate = 3e-4
5555
batch_size = 128
5656
swa_start = None
57-
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", 0))
57+
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", "0"))
5858
task_type: TaskType = "regression"
5959

6060

models/chgnet/ctk_trajectory_viewer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# %%
2929
init_struct_col = "initial_structure"
3030
df_cse = pd.read_json(f"{module_dir}/wbm-chgnet-bad-relax.json.gz").set_index(
31-
"material_id",
31+
"material_id"
3232
)
3333

3434

models/chgnet/test_chgnet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848

4949
# %%
50-
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", 0))
50+
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", "0"))
5151
out_path = f"{out_dir}/chgnet-preds-{slurm_array_task_id}.json.gz"
5252

5353
if os.path.isfile(out_path):

models/m3gnet/test_m3gnet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050

5151
# %%
52-
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", 3))
52+
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", "3"))
5353
out_path = f"{out_dir}/m3gnet-preds-{slurm_array_task_id}.json.gz"
5454

5555
if os.path.isfile(out_path):

models/megnet/test_megnet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151

5252
# %%
53-
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", 0))
53+
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", "0"))
5454
out_path = f"{out_dir}/megnet-e-form-preds.csv"
5555
if os.path.isfile(out_path):
5656
raise SystemExit(f"{out_path = } already exists, exciting early")

models/voronoi/voronoi_featurize_dataset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252

5353
# %%
54-
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", 0))
54+
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", "0"))
5555
run_name = f"{job_name}-{slurm_array_task_id}"
5656
out_path = f"{out_dir}/{run_name}.csv.bz2"
5757

models/wrenformer/train_wrenformer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
# %%
4545
learning_rate = 3e-4
4646
batch_size = 128
47-
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", 0))
47+
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", "0"))
4848
input_col = "wyckoff_spglib"
4949

5050
print(f"\nJob started running {timestamp}")

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ ignore = [
114114
"PLC0414", # useless-import-alias
115115
"PLC1901", # compare-to-empty-string
116116
"PLR", # pylint refactor
117-
"PLW1508", # invalid-envvar-default
118117
"PLW2901", # redefined-loop-name
119118
"PT006", # pytest-parametrize-names-wrong-type
120119
"PT011", # pytest-raises-too-broad

scripts/compute_struct_fingerprints.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"mp": DATA_FILES.mp_computed_structure_entries,
3434
}[data_name]
3535

36-
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", 0))
36+
slurm_array_task_id = int(os.getenv("SLURM_ARRAY_TASK_ID", "0"))
3737
slurm_array_task_count = 100
3838

3939
out_dir = f"{ROOT}/data/{data_name}"

site/package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
},
1818
"devDependencies": {
1919
"@iconify/svelte": "^3.1.3",
20-
"@rollup/plugin-yaml": "^4.0.1",
20+
"@rollup/plugin-yaml": "^4.1.0",
2121
"@sveltejs/adapter-static": "^2.0.2",
22-
"@sveltejs/kit": "^1.15.11",
23-
"@sveltejs/vite-plugin-svelte": "^2.1.1",
24-
"@typescript-eslint/eslint-plugin": "^5.59.2",
25-
"@typescript-eslint/parser": "^5.59.2",
22+
"@sveltejs/kit": "^1.16.3",
23+
"@sveltejs/vite-plugin-svelte": "^2.2.0",
24+
"@typescript-eslint/eslint-plugin": "^5.59.5",
25+
"@typescript-eslint/parser": "^5.59.5",
2626
"elementari": "^0.1.8",
27-
"eslint": "^8.39.0",
27+
"eslint": "^8.40.0",
2828
"eslint-plugin-svelte3": "^4.0.0",
2929
"hastscript": "^7.2.0",
3030
"js-yaml": "^4.1.0",
@@ -33,19 +33,19 @@
3333
"prettier": "^2.8.8",
3434
"prettier-plugin-svelte": "^2.10.0",
3535
"rehype-autolink-headings": "^6.1.1",
36-
"rehype-katex-svelte": "^1.1.2",
36+
"rehype-katex-svelte": "^1.2.0",
3737
"rehype-slug": "^5.1.0",
3838
"remark-math": "3.0.0",
39-
"svelte": "^3.58.0",
40-
"svelte-check": "^3.2.0",
39+
"svelte": "^3.59.1",
40+
"svelte-check": "^3.3.2",
4141
"svelte-multiselect": "^8.6.1",
4242
"svelte-preprocess": "^5.0.3",
4343
"svelte-toc": "^0.5.5",
4444
"svelte-zoo": "^0.4.5",
45-
"svelte2tsx": "^0.6.11",
45+
"svelte2tsx": "^0.6.14",
4646
"tslib": "^2.5.0",
4747
"typescript": "5.0.4",
48-
"vite": "^4.3.4"
48+
"vite": "^4.3.5"
4949
},
5050
"prettier": {
5151
"semi": false,
+2-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import type { Citation } from '$lib'
21
import fs from 'fs'
3-
import yml from 'js-yaml'
42

5-
export const load = async ({ route }) => {
3+
export const load = ({ route }) => {
64
const data = fs.readFileSync(`src/routes/${route.id}/+page.md`, `utf8`)
7-
const cff = fs.readFileSync(`../citation.cff`, `utf8`)
85

96
// Count the number of words using a regular expression
107
const word_count = data.match(/\b\w+\b/g)?.length ?? null
118

12-
return { word_count, ...(yml.load(cff) as Citation) }
9+
return { word_count }
1310
}

site/src/routes/preprint/+layout.svelte

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
<script lang="ts">
22
import { References } from '$lib'
3+
import cite from '$root/citation.cff'
34
import { pretty_num } from 'elementari/labels'
45
import { references } from './references.yaml'
56
67
export let data
78
8-
const authors = data.authors.map(
9+
const authors = cite.authors.map(
910
(auth) => `${auth[`given-names`]} ${auth[`family-names`]}<sup>${auth.affil_key}</sup>`
1011
)
1112
</script>
1213

13-
<h1>{data.title}<br /><small>{data.subtitle}</small></h1>
14+
<h1>{cite.title}<br /><small>{cite.subtitle}</small></h1>
1415

1516
<address>
1617
<span>
1718
{@html authors.join(`, `)}
1819
</span>
1920
<span>
20-
{@html data.affiliations.map((affil, idx) => `${idx + 1}. ${affil}`).join(`<br/>`)}
21+
{@html cite.affiliations.map((affil, idx) => `${idx + 1}. ${affil}`).join(`<br/>`)}
2122
</span>
22-
<span style="font-weight: lighter;">{data[`date-released`]}</span>
23+
<span style="font-weight: lighter;">{cite[`date-released`]}</span>
2324
</address>
2425

2526
<div>

site/vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { sveltekit } from '@sveltejs/kit/vite'
33
import type { UserConfig } from 'vite'
44

55
export default {
6-
plugins: [sveltekit(), yaml()],
6+
plugins: [sveltekit(), yaml({ extensions: [`.yml`, `.yaml`, `.cff`] })],
77

88
server: {
99
fs: { allow: [`../..`] }, // needed to import from $root

0 commit comments

Comments
 (0)