From 1e9fd0c4b565bad410ef7e1b1ffd0b53b31a8548 Mon Sep 17 00:00:00 2001 From: 36000 Date: Tue, 2 Apr 2024 11:33:38 -0700 Subject: [PATCH 1/4] [ENH] make table optional --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 74d704a..42a28fb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,7 +41,6 @@ install_requires = seaborn==0.13.0 scikit-learn==1.2.1 sklearn_pandas>=2.0.0 - tables==3.9.1 tqdm statsmodels==0.14.0 copt==0.9.1 @@ -50,6 +49,8 @@ include_package_data = True packages = find: [options.extras_require] +hdf5 = + tables==3.9.1 torch = torch tf = From ac50229cf03d9ea93e78f3b3a964b524392ddb7c Mon Sep 17 00:00:00 2001 From: 36000 Date: Tue, 2 Apr 2024 12:34:18 -0700 Subject: [PATCH 2/4] flesh this out --- .github/workflows/docbuild.yml | 2 +- afqinsight/h5io.py | 11 +++++++++++ setup.cfg | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docbuild.yml b/.github/workflows/docbuild.yml index 392444d..eaa42f5 100644 --- a/.github/workflows/docbuild.yml +++ b/.github/workflows/docbuild.yml @@ -20,7 +20,7 @@ jobs: - name: Install run: | python -m pip install --upgrade pip - python -m pip install .[dev] + python -m pip install .[dev,tables] - name: Build docs run: | cd doc diff --git a/afqinsight/h5io.py b/afqinsight/h5io.py index c01877a..d70c339 100644 --- a/afqinsight/h5io.py +++ b/afqinsight/h5io.py @@ -39,6 +39,17 @@ import tables import warnings from scipy import sparse +from dipy.utils.optpkg import optional_package + + +tables_msg = ( + "To use AFQ-Insight's h5io classes, you will need to have tables " + "installed. You can do this by installing afqinsight with `pip install " + "afqinsight[tables]`, or by separately installing these packages with " + "`pip install tables`." +) +tables, HAS_TABLES, _ = optional_package("tables", trip_msg=tables_msg) + try: import pandas as pd diff --git a/setup.cfg b/setup.cfg index 42a28fb..e1f8489 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,7 +49,7 @@ include_package_data = True packages = find: [options.extras_require] -hdf5 = +tables = tables==3.9.1 torch = torch From 58e1be99fa3ee23550b9698af41114f5a98d544d Mon Sep 17 00:00:00 2001 From: 36000 Date: Tue, 2 Apr 2024 12:40:03 -0700 Subject: [PATCH 3/4] bf --- afqinsight/h5io.py | 1 - 1 file changed, 1 deletion(-) diff --git a/afqinsight/h5io.py b/afqinsight/h5io.py index d70c339..981dfad 100644 --- a/afqinsight/h5io.py +++ b/afqinsight/h5io.py @@ -36,7 +36,6 @@ """ import numpy as np -import tables import warnings from scipy import sparse from dipy.utils.optpkg import optional_package From 51709b71e7574f6040b273b0fb8f292a5c5aa9ed Mon Sep 17 00:00:00 2001 From: 36000 Date: Tue, 2 Apr 2024 12:50:00 -0700 Subject: [PATCH 4/4] add tables to all --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index e1f8489..f70d775 100644 --- a/setup.cfg +++ b/setup.cfg @@ -78,6 +78,7 @@ maint = rapidfuzz all = + %(tables)s %(torch)s %(tf)s %(dev)s