Coverage for src/ipyvizzustory/__init__.py: 100%
11 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-25 14:02 +0100
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-25 14:02 +0100
1"""Python integration of Vizzu-Story."""
4from .storylib.story import Step, Slide
6from .env.py.story import Story as PythonStory
8try:
9 from .env.ipy.story import Story as JupyterStory
10 import IPython # type: ignore
12 if not IPython.get_ipython(): # pragma: no cover
13 raise ImportError("JupyterStory")
14except ImportError as e: # pragma: no cover
15 JupyterStory = None # type: ignore
17try:
18 from .env.st.story import Story as StreamlitStory
19 import streamlit as st
21 if not st.scriptrunner.script_run_context.get_script_run_ctx(): # pragma: no cover
22 raise ImportError("StreamlitStory")
23except ImportError: # pragma: no cover
24 StreamlitStory = None # type: ignore
27def get_story():
28 """A method for returning the appropriate Story for the environment."""
30 return JupyterStory or StreamlitStory or PythonStory
33Story = get_story()