diff --git a/aiidalab_widgets_base/__init__.py b/aiidalab_widgets_base/__init__.py index 63b2bf7c2..16ad05f38 100644 --- a/aiidalab_widgets_base/__init__.py +++ b/aiidalab_widgets_base/__init__.py @@ -1,7 +1,5 @@ """Reusable widgets for AiiDAlab applications.""" -from aiida.manage import get_profile - _WARNING_TEMPLATE = """

Warning:

@@ -27,22 +25,31 @@ def is_running_in_jupyter(): return False -# load the default profile if no profile is loaded, and raise a deprecation warning -# this is a temporary solution to avoid breaking existing notebooks -# this will be removed in the next major release -if is_running_in_jupyter() and get_profile() is None: - # if no profile is loaded, load the default profile and raise a deprecation warning - from aiida import load_profile +if is_running_in_jupyter(): + from aiida.manage import get_profile from IPython.display import HTML, display - load_profile() + # load the default profile if no profile is loaded, and raise a deprecation warning + # this is a temporary solution to avoid breaking existing notebooks + # this will be removed in the next major release + if get_profile() is None: + # if no profile is loaded, load the default profile and raise a deprecation warning + from aiida import load_profile + + load_profile() + + profile = get_profile() + assert profile is not None, "Failed to load the default profile" + + # raise a deprecation warning + warning = HTML(_WARNING_TEMPLATE.format(profile=profile.name, version="v3.0.0")) + display(warning) + + from .static import styles + from .utils.loaders import load_css_stylesheet - profile = get_profile() - assert profile is not None, "Failed to load the default profile" + load_css_stylesheet(package=styles) - # raise a deprecation warning - warning = HTML(_WARNING_TEMPLATE.format(profile=profile.name, version="v3.0.0")) - display(warning) from .computational_resources import ( ComputationalResourcesWidget, diff --git a/setup.cfg b/setup.cfg index 1c13fdc92..8945ad5e5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,6 +64,10 @@ docs = pydata-sphinx-theme~=0.15 myst-nb~=1.1 + +[options.package_data] +aiidalab_widgets_base.static.styles = *.css + [bumpver] current_version = "v2.3.0a1" version_pattern = "vMAJOR.MINOR.PATCH[PYTAGNUM]"