Skip to content

Commit 37756a1

Browse files
committed
Update example
1 parent 6322120 commit 37756a1

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

jupyter-parameterized-kernel-spec/jupyter-parameterized-kernel-specs.md

+23-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
When creating a new kernel, we need to define a different "specs" file for each possible parameter combination used by the executable. For example, the xeus-cling kernel supports three different versions of the `C++` language, `C++11`, `C++14`, and `C++17`, which is specified by the `--std` command-line option.
66

7-
When installing xeus-cling, we install three almost identical kernel specs. The only difference is the last parameter of the execution command `-std=c++X`.
7+
When installing xeus-cling, we install three almost identical kernel specs. The only difference is the last parameter of the execution command `--std=c++X`.
88

99
When more than one parameter is available, the number of possible combinations grows in a combinatorics fashion.
1010

@@ -22,7 +22,7 @@ Some of the chosen parameter values can be saved in e.g. the notebook metadata s
2222

2323
## Detailed Explanation
2424

25-
As described in previous sections, we propose to parameterize the kernel specs file. In the example shown below, we can see the kernel specs file from the kernel xeus-cling. We suggest changing the last parameter of the execution command `-std=c++11` to have a variable `-std=${cpp_version}` and adding a new object `parameters` to the metadata of the kernel specs.
25+
As described in previous sections, we propose to parameterize the kernel specs file. In the example shown below, we can see the kernel specs file from the kernel xeus-cling. We suggest changing the last parameter of the execution command `-std=c++11` to have a variable `-std=${parameters.cpp_version}` and adding a new object `parameters` to the metadata of the kernel specs.
2626

2727
```=json
2828
{
@@ -33,6 +33,9 @@ As described in previous sections, we propose to parameterize the kernel specs f
3333
"{connection_file}",
3434
"-std=c++11"
3535
],
36+
env: [
37+
"XEUS_LOGLEVEL=ERROR"
38+
],
3639
"language": "C++11"
3740
}
3841
```
@@ -43,19 +46,28 @@ As described in previous sections, we propose to parameterize the kernel specs f
4346
"/home/user/micromamba/envs/kernel_spec/bin/xcpp",
4447
"-f",
4548
"{connection_file}",
46-
"-std=${parameters.cpp_version}"
49+
"-std={parameters.cpp_version}"
50+
],
51+
env: [
52+
"XEUS_LOGLEVEL={parameters.xeus_log_level}"
4753
],
4854
"language": "C++"
4955
"metadata": {
50-
"parameters": {
51-
"cpp_version": {
52-
"type": "string",
53-
"default": 'C++14',
54-
"enum": ['C++11', 'C++14', 'C++17'],
55-
"save": true
56-
}
56+
"parameters": {
57+
"cpp_version": {
58+
"type": "string",
59+
"default": "C++14",
60+
"enum": ["C++11", "C++14", "C++17"],
61+
"save": true
62+
},
63+
"xeus_log_level": {
64+
"type": "string",
65+
"default": "ERROR",
66+
"enum": ["TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"],
67+
"save": true
5768
}
58-
},
69+
}
70+
},
5971
}
6072
```
6173

0 commit comments

Comments
 (0)