From 6dc74b4abd5ff5cd3afbffcb1d8c58317ba5ad05 Mon Sep 17 00:00:00 2001 From: fspreck <f.spreckelsen@indiscale.com> Date: Tue, 6 Jun 2023 14:41:30 +0200 Subject: [PATCH] MAINT: Add optional HDF5 dependency --- setup.cfg | 3 +++ src/caoscrawler/hdf5_converter.py | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/caoscrawler/hdf5_converter.py diff --git a/setup.cfg b/setup.cfg index 8e642ee9..9e3f10d0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,3 +39,6 @@ per-file-ignores = __init__.py:F401 [options.entry_points] console_scripts = caosdb-crawler = caoscrawler.crawl:main + +[options.extras_require] +h5-crawler = h5py >= 3.8 diff --git a/src/caoscrawler/hdf5_converter.py b/src/caoscrawler/hdf5_converter.py new file mode 100644 index 00000000..1262aa55 --- /dev/null +++ b/src/caoscrawler/hdf5_converter.py @@ -0,0 +1,27 @@ +# +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2023 IndiScale GmbH <info@indiscale.com> +# Copyright (C) 2023 Florian Spreckelsen <f.spreckelsen@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# + +try: + import h5py +except ModuleNotFoundError: + raise ModuleNotFoundError( + "Couldn't find module h5py. Did you install the crawler package with " + "its optional `h5-crawler` dependency?" + ) -- GitLab