Skip to content

Commit be1f666

Browse files
Create ui tests for jupyterlab extensions (#1)
1 parent 6a8384a commit be1f666

File tree

42 files changed

+829
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+829
-4
lines changed

environment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies:
88
- git
99
- ruff=0.9.10
1010
- nb_conda_kernels=2.5.1
11+
- black=25.1.0
1112
# Extensions
1213
- papermill=2.6.0
1314
- voila=0.5.8
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"def my_function(x, y):\n",
10+
" print(x, y)"
11+
]
12+
}
13+
],
14+
"metadata": {
15+
"language_info": {
16+
"name": "python"
17+
}
18+
},
19+
"nbformat": 4,
20+
"nbformat_minor": 2
21+
}

notebooks/test-dash.ipynb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"from dash import dcc, html, Dash\n",
10+
"app = Dash(__name__)\n",
11+
"app.layout = html.Div([\n",
12+
" dcc.Graph(\n",
13+
" id='graph',\n",
14+
" figure={\n",
15+
" 'data': [{\n",
16+
" 'x': [1, 2, 3, 4],\n",
17+
" 'y': [10, 11, 12, 13],\n",
18+
" 'type': 'line',\n",
19+
" 'name': 'Test',\n",
20+
" }],\n",
21+
" 'layout': {\n",
22+
" 'title': 'Dash in JupyterLab'\n",
23+
" }\n",
24+
" })\n",
25+
"])\n",
26+
"app.run_server(host=\"0.0.0.0\", port=8052)"
27+
]
28+
}
29+
],
30+
"metadata": {
31+
"language_info": {
32+
"name": "python"
33+
}
34+
},
35+
"nbformat": 4,
36+
"nbformat_minor": 2
37+
}

notebooks/test-git.ipynb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"print(\"Testing git difference\")"
10+
]
11+
}
12+
],
13+
"metadata": {
14+
"language_info": {
15+
"name": "python"
16+
}
17+
},
18+
"nbformat": 4,
19+
"nbformat_minor": 2
20+
}

notebooks/test-ipydatagrid.ipynb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import numpy as np\n",
10+
"import pandas as pd\n",
11+
"import ipydatagrid\n",
12+
"\n",
13+
"data = pd.DataFrame(\n",
14+
" np.random.randint(0, 100, size=(5, 5)), \n",
15+
" columns=[\"A\", \"B\", \"C\", \"D\", \"E\"]\n",
16+
")\n",
17+
"\n",
18+
"grid = ipydatagrid.DataGrid(data, editable=True)\n",
19+
"\n",
20+
"grid\n"
21+
]
22+
}
23+
],
24+
"metadata": {
25+
"language_info": {
26+
"name": "python"
27+
}
28+
},
29+
"nbformat": 4,
30+
"nbformat_minor": 2
31+
}

notebooks/test-ipympl.ipynb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"# Activate ipympl\n",
10+
"%matplotlib widget \n",
11+
"\n",
12+
"import matplotlib.pyplot as plt \n",
13+
"import numpy as np \n",
14+
"\n",
15+
"x = np.linspace(0, 10, 100) \n",
16+
"y = np.sin(x) \n",
17+
"\n",
18+
"fig, ax = plt.subplots() \n",
19+
"ax.plot(x, y) \n",
20+
"plt.show()\n"
21+
]
22+
}
23+
],
24+
"metadata": {
25+
"language_info": {
26+
"name": "python"
27+
}
28+
},
29+
"nbformat": 4,
30+
"nbformat_minor": 2
31+
}

notebooks/test-ipywidgets.ipynb

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"data": {
10+
"application/vnd.jupyter.widget-view+json": {
11+
"model_id": "50782ddbb20d4554b3177cd46a259adf",
12+
"version_major": 2,
13+
"version_minor": 0
14+
},
15+
"text/plain": [
16+
"IntSlider(value=50, description='Slider:')"
17+
]
18+
},
19+
"metadata": {},
20+
"output_type": "display_data"
21+
},
22+
{
23+
"data": {
24+
"application/vnd.jupyter.widget-view+json": {
25+
"model_id": "2798f6e7c7b34b76be50958d5d60fd5c",
26+
"version_major": 2,
27+
"version_minor": 0
28+
},
29+
"text/plain": [
30+
"Button(description='Click Me', style=ButtonStyle())"
31+
]
32+
},
33+
"metadata": {},
34+
"output_type": "display_data"
35+
},
36+
{
37+
"data": {
38+
"application/vnd.jupyter.widget-view+json": {
39+
"model_id": "e4b5b3a74ffd4947912da1c191a393c0",
40+
"version_major": 2,
41+
"version_minor": 0
42+
},
43+
"text/plain": [
44+
"Output()"
45+
]
46+
},
47+
"metadata": {},
48+
"output_type": "display_data"
49+
}
50+
],
51+
"source": [
52+
"import ipywidgets as widgets\n",
53+
"from IPython.display import display\n",
54+
"\n",
55+
"slider = widgets.IntSlider(value=50, min=0, max=100, description=\"Slider:\")\n",
56+
"\n",
57+
"button = widgets.Button(description=\"Click Me\")\n",
58+
"\n",
59+
"output = widgets.Output()\n",
60+
"\n",
61+
"def on_button_click(b):\n",
62+
" with output:\n",
63+
" print(\"Button Clicked!\")\n",
64+
"\n",
65+
"button.on_click(on_button_click)\n",
66+
"\n",
67+
"display(slider, button, output)"
68+
]
69+
},
70+
{
71+
"cell_type": "code",
72+
"execution_count": null,
73+
"metadata": {},
74+
"outputs": [],
75+
"source": []
76+
}
77+
],
78+
"metadata": {
79+
"kernelspec": {
80+
"display_name": "Python 3 (ipykernel)",
81+
"language": "python",
82+
"name": "python3"
83+
},
84+
"language_info": {
85+
"codemirror_mode": {
86+
"name": "ipython",
87+
"version": 3
88+
},
89+
"file_extension": ".py",
90+
"mimetype": "text/x-python",
91+
"name": "python",
92+
"nbconvert_exporter": "python",
93+
"pygments_lexer": "ipython3",
94+
"version": "3.12.7"
95+
}
96+
},
97+
"nbformat": 4,
98+
"nbformat_minor": 4
99+
}

notebooks/test-lsp.ipynb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import numpy as np\n",
10+
"np"
11+
]
12+
}
13+
],
14+
"metadata": {
15+
"language_info": {
16+
"name": "python"
17+
}
18+
},
19+
"nbformat": 4,
20+
"nbformat_minor": 2
21+
}

notebooks/test-papermill.ipynb

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"tags": [
8+
"parameters"
9+
]
10+
},
11+
"outputs": [],
12+
"source": [
13+
"# Parameters\n",
14+
"param1 = \"default_value\"\n",
15+
"param2 = 0"
16+
]
17+
},
18+
{
19+
"cell_type": "code",
20+
"execution_count": null,
21+
"metadata": {},
22+
"outputs": [],
23+
"source": [
24+
"result = f\"Processed {param1} with value {param2}\"\n",
25+
"print(result)"
26+
]
27+
},
28+
{
29+
"cell_type": "code",
30+
"execution_count": null,
31+
"metadata": {},
32+
"outputs": [],
33+
"source": [
34+
"import datetime\n",
35+
"print(f\"Notebook executed at {datetime.datetime.now()}\")"
36+
]
37+
}
38+
],
39+
"metadata": {
40+
"kernelspec": {
41+
"display_name": "Python 3 (ipykernel)",
42+
"language": "python",
43+
"name": "python3"
44+
},
45+
"language_info": {
46+
"codemirror_mode": {
47+
"name": "ipython",
48+
"version": 3
49+
},
50+
"file_extension": ".py",
51+
"mimetype": "text/x-python",
52+
"name": "python",
53+
"nbconvert_exporter": "python",
54+
"pygments_lexer": "ipython3",
55+
"version": "3.12.7"
56+
}
57+
},
58+
"nbformat": 4,
59+
"nbformat_minor": 4
60+
}

notebooks/test-voila.ipynb

Lines changed: 132 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)