Skip to content

Commit

Permalink
Make async earthranger client optional (#237)
Browse files Browse the repository at this point in the history
Co-authored-by: Charles Stern <[email protected]>
  • Loading branch information
atmorling and cisaacstern authored Aug 5, 2024
1 parent 1a4ef1e commit 5511323
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
9 changes: 7 additions & 2 deletions ecoscope/io/__init__.py
Original file line number Diff line number Diff line change
@@ -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
11 changes: 9 additions & 2 deletions ecoscope/io/async_earthranger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers=[
dependencies = [
"backoff",
"earthengine-api",
"earthranger-client @ git+https://github.com/PADAS/[email protected]",
"earthranger-client",
"geopandas<=0.14.2",
"pyproj",
"rasterio",
Expand All @@ -50,6 +50,9 @@ analysis = [
"scikit-image",
"scikit-learn",
]
async_earthranger = [
"earthranger-client @ git+https://github.com/PADAS/[email protected]",
]
mapping = [
"lonboard @ git+https://github.com/wildlife-dynamics/lonboard@77c56d30a9c2dd96fd863e910bf62952cfa36da8",
"matplotlib",
Expand Down

0 comments on commit 5511323

Please sign in to comment.