Skip to content

Commit

Permalink
Don't require geopandas if wntr is already well installed without it
Browse files Browse the repository at this point in the history
  • Loading branch information
angusmcb committed Dec 24, 2024
1 parent 59169f1 commit 0fe146a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/conda-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
12 changes: 7 additions & 5 deletions wntrqgis/dependency_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -52,7 +55,6 @@ def _check_dependencies():

@staticmethod
def _check_wntr() -> str | None:
invalidate_caches()
if find_spec("wntr") is None:
return None
try:
Expand Down

0 comments on commit 0fe146a

Please sign in to comment.