Skip to content

Commit 6c3f50a

Browse files
committed
Add xeus-cpp-lite specific demo for deployment example
1 parent e6f4012 commit 6c3f50a

File tree

2 files changed

+116
-1
lines changed

2 files changed

+116
-1
lines changed

.github/workflows/deploy-github-page.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
micromamba create -n xeus-lite-host jupyterlite-core
7878
micromamba activate xeus-lite-host
7979
python -m pip install jupyterlite-xeus jupyter_server
80-
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks --output-dir dist
80+
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --output-dir dist
8181
cp $PREFIX/bin/xcpp.data dist/extensions/@jupyterlite/xeus/static
8282
cp $PREFIX/lib/libclangCppInterOp.so dist/extensions/@jupyterlite/xeus/static
8383

notebooks/xeus-cpp-lite-demo.ipynb

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "aa9d4f33-5bd8-42f2-918a-e654d4363577",
6+
"metadata": {},
7+
"source": [
8+
"<center>\n",
9+
" <h1>C++ kernel based on xeus</h1>\n",
10+
"</center>\n",
11+
"\n",
12+
"A Jupyter kernel for C++ based on the `CppInterOp`, a clang based C++ Interoperability Library and the `xeus` native implementation of the Jupyter protocol, xeus.\n",
13+
"\n",
14+
"- GitHub repository: https://github.com/compiler-research/xeus-cpp\n",
15+
"- Documentation: https://xeus-cpp.readthedocs.io/en/latest/"
16+
]
17+
},
18+
{
19+
"cell_type": "markdown",
20+
"id": "9af8aa44-7786-47b6-b94b-8579470acb3a",
21+
"metadata": {},
22+
"source": [
23+
"## Usage\n",
24+
"\n",
25+
"<div style=\"background: #efffed;\n",
26+
" border: 1px solid grey;\n",
27+
" margin: 8px 0 8px 0;\n",
28+
" text-align: center;\n",
29+
" padding: 8px; \">\n",
30+
" <i class=\"fa-play fa\" \n",
31+
" style=\"font-size: 40px;\n",
32+
" line-height: 40px;\n",
33+
" margin: 8px;\n",
34+
" color: #444;\">\n",
35+
" </i>\n",
36+
" <div>\n",
37+
" To run the selected code cell, hit <pre style=\"background: #efffed\">Shift + Enter</pre>\n",
38+
" </div>\n",
39+
"</div>"
40+
]
41+
},
42+
{
43+
"cell_type": "markdown",
44+
"id": "be1c8c6c-3fbe-4f53-9deb-8496c43d26ad",
45+
"metadata": {},
46+
"source": [
47+
"## Output and error streams\n",
48+
"\n",
49+
"`std::cout` and `std::cerr` are redirected to the notebook frontend."
50+
]
51+
},
52+
{
53+
"cell_type": "code",
54+
"execution_count": 1,
55+
"id": "9bd7f767-6c22-4a1b-a1e2-cd4184fd0367",
56+
"metadata": {
57+
"vscode": {
58+
"languageId": "c++"
59+
}
60+
},
61+
"outputs": [
62+
{
63+
"name": "stdout",
64+
"output_type": "stream",
65+
"text": [
66+
"some output\n"
67+
]
68+
}
69+
],
70+
"source": [
71+
"#include <iostream>\n",
72+
"\n",
73+
"std::cout << \"some output\" << std::endl;"
74+
]
75+
},
76+
{
77+
"cell_type": "code",
78+
"execution_count": 2,
79+
"id": "9622f20f-5925-4544-a97b-aada3a14209a",
80+
"metadata": {
81+
"vscode": {
82+
"languageId": "c++"
83+
}
84+
},
85+
"outputs": [
86+
{
87+
"name": "stderr",
88+
"output_type": "stream",
89+
"text": [
90+
"some error\n"
91+
]
92+
}
93+
],
94+
"source": [
95+
"std::cerr << \"some error\" << std::endl;"
96+
]
97+
}
98+
],
99+
"metadata": {
100+
"kernelspec": {
101+
"display_name": "C++20",
102+
"language": "cpp",
103+
"name": "xcpp20"
104+
},
105+
"language_info": {
106+
"codemirror_mode": "text/x-c++src",
107+
"file_extension": ".cpp",
108+
"mimetype": "text/x-c++src",
109+
"name": "C++",
110+
"version": "20"
111+
}
112+
},
113+
"nbformat": 4,
114+
"nbformat_minor": 5
115+
}

0 commit comments

Comments
 (0)