From 2ee88fad91700c24465a0b3c337ce2b248c26a95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Fri, 23 Jul 2021 10:24:42 +0000
Subject: [PATCH] REL: Make h5py optional

---
 .docker/Dockerfile | 2 +-
 CHANGELOG.md       | 1 +
 README_SETUP.md    | 8 ++++++++
 setup.py           | 3 ++-
 tox.ini            | 1 +
 5 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/.docker/Dockerfile b/.docker/Dockerfile
index e7bc28ac..4ad0d623 100644
--- a/.docker/Dockerfile
+++ b/.docker/Dockerfile
@@ -29,6 +29,6 @@ RUN pip3 install recommonmark sphinx-rtd-theme
 COPY . /git
 RUN rm -r /git/.git \
     && mv /git/.docker/pycaosdb.ini /git/integrationtests
-RUN cd /git && pip3 install .
+RUN cd /git && pip3 install .[h5-crawler]
 WORKDIR /git/integrationtests
 CMD /wait-for-it.sh caosdb-server:10443 -t 500 -- ./test.sh
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eda225cc..7844075f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Crawler documentation
 - Proof-of-concept integration with Bloxberg.
 - Introduce a cfood that can create a Record structure based on the contents of a hdf5 file
+  h5py is now an optional dependency
 
 ### Changed ###
 
diff --git a/README_SETUP.md b/README_SETUP.md
index 19f05163..0ac69cf9 100644
--- a/README_SETUP.md
+++ b/README_SETUP.md
@@ -12,6 +12,11 @@ Dependencies will be installed automatically if you use the below described proc
 - `caosdb>=0.4.0`                                      
 - `openpyxl>=3.0.0`
 - `xlrd>=1.2.0`
+-  `pandas>=1.2.0`
+- `numpy>=1.17.3`
+
+If you want to use the optional h5-crawler the following dependencies will be installed additionally:
+- `h5py>=3.3.0`
 
 For testing:
 - `tox`
@@ -21,6 +26,9 @@ For testing:
 - `pip install . --user`
 - `pip install tox --user`
 
+Optional h5-crawler:
+- `pip install .[h5-crawler] --user`
+
 ## Run Unit Tests
 `tox`
 
diff --git a/setup.py b/setup.py
index 89b7f106..77286653 100755
--- a/setup.py
+++ b/setup.py
@@ -159,8 +159,9 @@ def setup_package():
                           "pandas>=1.2.0",
                           "numpy>=1.17.3",
                           "xlrd>=2.0",
-                          "h5py",
                           ],
+        extras_require={"h5-crawler": ["h5py>=3.3.0", ],
+                        },
         packages=find_packages('src'),
         package_dir={'': 'src'},
         setup_requires=["pytest-runner>=2.0,<3dev"],
diff --git a/tox.ini b/tox.ini
index d41e9930..1b3cd4ef 100644
--- a/tox.ini
+++ b/tox.ini
@@ -9,4 +9,5 @@ deps=nose
     pytest-cov
     openpyxl
     xlrd == 1.2
+    h5py
 commands=py.test --cov=caosadvancedtools -vv {posargs}
-- 
GitLab