diff --git a/ecoscope/io/__init__.py b/ecoscope/io/__init__.py index c7b89572..2aae2dd7 100644 --- a/ecoscope/io/__init__.py +++ b/ecoscope/io/__init__.py @@ -1,15 +1,20 @@ from ecoscope.io import earthranger, eetools, raster, utils from ecoscope.io.earthranger import EarthRangerIO -from ecoscope.io.async_earthranger import AsyncEarthRangerIO from ecoscope.io.utils import download_file __all__ = [ "earthranger", "EarthRangerIO", - "AsyncEarthRangerIO", "download_file", "earthranger_utils", "eetools", "raster", "utils", ] + +try: + from ecoscope.io.async_earthranger import AsyncEarthRangerIO + + __all__ += ["AsyncEarthRangerIO"] +except ImportError: + pass diff --git a/ecoscope/io/async_earthranger.py b/ecoscope/io/async_earthranger.py index 7049557c..3b30db16 100644 --- a/ecoscope/io/async_earthranger.py +++ b/ecoscope/io/async_earthranger.py @@ -3,11 +3,18 @@ import pandas as pd import asyncio from dateutil import parser -from erclient.client import AsyncERClient + +import ecoscope from ecoscope.io.utils import to_hex from ecoscope.io.earthranger_utils import clean_kwargs, to_gdf -import ecoscope +try: + from erclient.client import AsyncERClient +except ModuleNotFoundError: + raise ModuleNotFoundError( + 'Missing optional dependencies required by this module. \ + Please run pip install ecoscope["async_earthranger"]' + ) class AsyncEarthRangerIO(AsyncERClient): diff --git a/pyproject.toml b/pyproject.toml index 669db378..c6357500 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ classifiers=[ dependencies = [ "backoff", "earthengine-api", - "earthranger-client @ git+https://github.com/PADAS/er-client@v1.2.3", + "earthranger-client", "geopandas<=0.14.2", "pyproj", "rasterio", @@ -50,6 +50,9 @@ analysis = [ "scikit-image", "scikit-learn", ] +async_earthranger = [ + "earthranger-client @ git+https://github.com/PADAS/er-client@v1.2.3", +] mapping = [ "lonboard @ git+https://github.com/wildlife-dynamics/lonboard@77c56d30a9c2dd96fd863e910bf62952cfa36da8", "matplotlib",