Skip to content

Commit 6873b1c

Browse files
committed
Don't import _main in pyodide
1 parent efc14cc commit 6873b1c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

shiny/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""A package for building reactive web applications."""
22

3+
from ._shinyenv import is_pyodide as _is_pyodide
4+
35
# User-facing subpackages that should be available on `from shiny import *`
46
from . import reactive
57
from .render import *
@@ -9,9 +11,15 @@
911
# Private submodules that have some user-facing functionality
1012
from ._app import App
1113
from ._decorators import event
12-
from ._main import run as run_app
1314
from ._validation import req
1415

16+
if _is_pyodide:
17+
# In pyodide, avoid importing _main because it imports packages that aren't
18+
# available.
19+
run_app = None
20+
else:
21+
from ._main import run as run_app
22+
1523
# User-facing submodules that should *not* be available on `from shiny import *`
1624
from . import modules
1725
from . import types

0 commit comments

Comments
 (0)