Skip to content

Commit 5beb84f

Browse files
committed
Use %pip install even if it is visible
1 parent 890e484 commit 5beb84f

3 files changed

Lines changed: 2 additions & 23 deletions

File tree

Basics.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@
539539
},
540540
"outputs": [],
541541
"source": [
542+
"%pip install jupyterquiz\n",
542543
"from quizzes import display_quiz\n",
543544
"display_quiz(\"quizzes/datatypes.json\")"
544545
]

Basics_filled.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@
762762
},
763763
"outputs": [],
764764
"source": [
765+
"%pip install jupyterquiz\n",
765766
"from quizzes import display_quiz\n",
766767
"display_quiz(\"quizzes/datatypes.json\")"
767768
]

quizzes/__init__.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,3 @@
1-
import sys
2-
3-
from importlib.util import find_spec
4-
5-
async def _ensure_dependencies():
6-
"""Ensure jupyterquiz is installed in Pyodide."""
7-
if find_spec('jupyterquiz') is None:
8-
import micropip
9-
await micropip.install('jupyterquiz>=2.9')
10-
11-
# Auto-install on import
12-
if 'pyodide' in sys.modules: # Only in browser
13-
import asyncio
14-
# Check if we're in a running event loop
15-
try:
16-
loop = asyncio.get_running_loop()
17-
# Already in async context, can await directly
18-
await _ensure_dependencies()
19-
except RuntimeError:
20-
# No running loop, create one
21-
asyncio.run(_ensure_dependencies())
22-
23-
# Now import normally
241
import jupyterquiz
252

263
def display_quiz(json_path):

0 commit comments

Comments
 (0)