Files
Buffteks-Website/streamlit-venv/lib/python3.10/site-packages/altair/jupyter/__init__.py
2025-01-10 21:40:35 +00:00

22 lines
876 B
Python
Executable File

try:
import anywidget # noqa: F401
except ImportError:
# When anywidget isn't available, create stand-in JupyterChart class
# that raises an informative import error on construction. This
# way we can make JupyterChart available in the altair namespace
# when anywidget is not installed
class JupyterChart:
def __init__(self, *args, **kwargs):
msg = (
"The Altair JupyterChart requires the anywidget \n"
"Python package which may be installed using pip with\n"
" pip install anywidget\n"
"or using conda with\n"
" conda install -c conda-forge anywidget\n"
"Afterwards, you will need to restart your Python kernel."
)
raise ImportError(msg)
else:
from .jupyter_chart import JupyterChart # noqa: F401