Skip to content

Commit b57e8f1

Browse files
committed
adds voila env variable example
1 parent 2bdfdb5 commit b57e8f1

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

examples/voila/env-variable/app.ipynb

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 2,
6+
"id": "83a15137-3ea2-47d4-871a-382213ba046e",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from os import environ\n",
11+
"\n",
12+
"value = environ.get(\"ENV_VAR\", None)"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 3,
18+
"id": "764d3d46-11fb-4689-bf2f-a8558205323f",
19+
"metadata": {},
20+
"outputs": [
21+
{
22+
"name": "stdout",
23+
"output_type": "stream",
24+
"text": [
25+
"ENV_VAR is undefined\n"
26+
]
27+
}
28+
],
29+
"source": [
30+
"if value is None:\n",
31+
" print(\"ENV_VAR is undefined\")\n",
32+
"else:\n",
33+
" print(f\"EN_VAR: {value}\")"
34+
]
35+
}
36+
],
37+
"metadata": {
38+
"kernelspec": {
39+
"display_name": "Python 3 (ipykernel)",
40+
"language": "python",
41+
"name": "python3"
42+
},
43+
"language_info": {
44+
"codemirror_mode": {
45+
"name": "ipython",
46+
"version": 3
47+
},
48+
"file_extension": ".py",
49+
"mimetype": "text/x-python",
50+
"name": "python",
51+
"nbconvert_exporter": "python",
52+
"pygments_lexer": "ipython3",
53+
"version": "3.11.5"
54+
}
55+
},
56+
"nbformat": 4,
57+
"nbformat_minor": 5
58+
}

examples/voila/env-variable/requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)