From 0b4f5a160ae0079fbf7f8911978f9751d1692be7 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Fri, 2 Feb 2024 15:51:22 +0000 Subject: [PATCH] Move optimade dependency as extra dependency --- aiidalab_widgets_base/databases.py | 12 +++++++++++- setup.cfg | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/aiidalab_widgets_base/databases.py b/aiidalab_widgets_base/databases.py index 9b7bd149a..4f34f0f06 100644 --- a/aiidalab_widgets_base/databases.py +++ b/aiidalab_widgets_base/databases.py @@ -156,7 +156,17 @@ def __init__( title: str = None, **kwargs, ) -> None: - from optimade_client import default_parameters, query_filter, query_provider + try: + from optimade_client import default_parameters, query_filter, query_provider + except ImportError: + super().__init__( + [ + ipw.HTML( + "This widget requires the `optimade-client` package to be installed." + ) + ] + ) + return providers_header = ipw.HTML("

Select a provider

") providers = query_provider.OptimadeQueryProviderWidget( diff --git a/setup.cfg b/setup.cfg index e10ba078a..34d08d935 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,7 +34,6 @@ install_requires = more-itertools~=8.0 pymysql~=0.9 nglview~=3.0 - optimade-client==2022.9.19 spglib>=1.14,<3 vapory~=0.1.2 python_requires = >=3.8 @@ -56,6 +55,8 @@ dev = pytest-timeout~=2.2 selenium~=4.7.0 webdriver-manager~=3.8 +optimade = + optimade-client==2022.9.19 smiles = rdkit>=2021.09.2 scikit-learn~=1.0.0