From 0fe146a4a219c7ac7b623c1f0d0573a5929dca22 Mon Sep 17 00:00:00 2001 From: angusmcb Date: Tue, 24 Dec 2024 10:37:32 +0100 Subject: [PATCH] Don't require geopandas if wntr is already well installed without it --- .github/workflows/conda-tests.yml | 2 +- wntrqgis/dependency_management.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/conda-tests.yml b/.github/workflows/conda-tests.yml index 4411a87..17cf7e3 100644 --- a/.github/workflows/conda-tests.yml +++ b/.github/workflows/conda-tests.yml @@ -33,7 +33,7 @@ jobs: auto-activate-base: false - name: Install packages run: | - conda install -y pytest geopandas ${{ matrix.wntr-version}} ${{ matrix.qgis }} + conda install -y pytest ${{ matrix.wntr-version}} ${{ matrix.qgis }} pip install pytest-qgis pytest-cov - name: Conda info run: | diff --git a/wntrqgis/dependency_management.py b/wntrqgis/dependency_management.py index ece5983..8da66a6 100644 --- a/wntrqgis/dependency_management.py +++ b/wntrqgis/dependency_management.py @@ -17,6 +17,12 @@ class WqDependencyManagement: @classmethod def import_wntr(cls): + if not cls._wntr__available_version: + cls._wntr__available_version = cls._check_wntr() + + if cls._wntr__available_version: + return cls._wntr__available_version + if not cls._dependencies_available: missing_deps = cls._check_dependencies() if len(missing_deps): @@ -25,10 +31,7 @@ def import_wntr(cls): cls._dependencies_available = True - if not cls._wntr__available_version: - cls._wntr__available_version = cls._check_wntr() - - return cls._wntr__available_version + return None @classmethod def ensure_wntr(cls): @@ -52,7 +55,6 @@ def _check_dependencies(): @staticmethod def _check_wntr() -> str | None: - invalidate_caches() if find_spec("wntr") is None: return None try: