diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..067a198 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,26 @@ +FROM mcr.microsoft.com/devcontainers/miniconda:0-3 + +# Copy environment.yml (if found) to a temp location so we update the environment. Also +# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists. +USER root +COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/ +RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \ + && rm -rf /tmp/conda-tmp + +USER vscode + +# WORKDIR /tmp/stac_ipyleaflet +# COPY . . +# RUN /opt/conda/bin/pip install -e . + + +# [Optional] Uncomment to install a different version of Python than the default +# RUN conda install -y python=3.6 \ +# && pip install --no-cache-dir pipx \ +# && pipx reinstall-all + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..29f4923 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/miniconda +{ + "name": "Miniconda (Python 3)", + "build": { + "context": "..", + "dockerfile": "Dockerfile" + }, + "features": { + "ghcr.io/devcontainers/features/node:1": {} + } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + //"postCreateCommand": "pip install -e ." + //"postCreateCommand": "conda init bash" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/noop.txt b/.devcontainer/noop.txt new file mode 100644 index 0000000..abee195 --- /dev/null +++ b/.devcontainer/noop.txt @@ -0,0 +1,3 @@ +This file is copied into the container along with environment.yml* from the +parent folder. This is done to prevent the Dockerfile COPY instruction from +failing if no environment.yml is found. \ No newline at end of file diff --git a/demo.ipynb b/demo.ipynb index 0f41c47..1ae9fd1 100644 --- a/demo.ipynb +++ b/demo.ipynb @@ -5,7 +5,24 @@ "execution_count": 1, "id": "4f7d5321-d82b-4ed4-8136-832f932b30b5", "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "ImportError", + "evalue": "libpoppler.so.126: cannot open shared object file: No such file or directory", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mstac_ipyleaflet\u001b[39;00m\n", + "File \u001b[0;32m/workspaces/stac_ipyleaflet/stac_ipyleaflet/__init__.py:7\u001b[0m\n\u001b[1;32m 4\u001b[0m __email__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124maimee@developmentseed.org\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 5\u001b[0m __version__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m0.1.0\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m----> 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n", + "File \u001b[0;32m/workspaces/stac_ipyleaflet/stac_ipyleaflet/core.py:15\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;66;03m#from pydantic import BaseModel\u001b[39;00m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mshapely\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mgeometry\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Polygon\n\u001b[0;32m---> 15\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrioxarray\u001b[39;00m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mxarray\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mxr\u001b[39;00m\n\u001b[1;32m 17\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m\n", + "File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/rioxarray/__init__.py:5\u001b[0m\n\u001b[1;32m 2\u001b[0m __author__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\"\"\u001b[39m\u001b[38;5;124mrioxarray Contributors\u001b[39m\u001b[38;5;124m\"\"\"\u001b[39m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mimportlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmetadata\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrioxarray\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mraster_array\u001b[39;00m \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrioxarray\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mraster_dataset\u001b[39;00m \u001b[38;5;66;03m# noqa\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrioxarray\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_io\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m open_rasterio \u001b[38;5;66;03m# noqa\u001b[39;00m\n", + "File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/rioxarray/raster_array.py:19\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mtyping\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Any, Literal, Optional, Union\n\u001b[1;32m 18\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mnp\u001b[39;00m\n\u001b[0;32m---> 19\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmask\u001b[39;00m\n\u001b[1;32m 21\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mwarp\u001b[39;00m\n", + "File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/rasterio/__init__.py:28\u001b[0m\n\u001b[1;32m 24\u001b[0m os\u001b[38;5;241m.\u001b[39madd_dll_directory(os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mabspath(p))\n\u001b[1;32m 27\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_show_versions\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m show_versions\n\u001b[0;32m---> 28\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_version\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m gdal_version, get_geos_version, get_proj_version\n\u001b[1;32m 29\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcrs\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m CRS\n\u001b[1;32m 30\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrasterio\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdrivers\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m driver_from_extension, is_blacklisted\n", + "\u001b[0;31mImportError\u001b[0m: libpoppler.so.126: cannot open shared object file: No such file or directory" + ] + } + ], "source": [ "import stac_ipyleaflet" ] @@ -59,9 +76,9 @@ ], "metadata": { "kernelspec": { - "display_name": "stac_ipyleaflet", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "stac_ipyleaflet" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -73,7 +90,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.15" + "version": "3.10.8" } }, "nbformat": 4, diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..48220fc --- /dev/null +++ b/environment.yml @@ -0,0 +1,8 @@ +name: stac_ipyleaflet +channels: + - conda-forge +dependencies: + - jupyterlab + - pip + - gdal + - rasterio>=1.3 diff --git a/setup.cfg b/setup.cfg index fd4a4f5..a5627d5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,22 @@ +[metadata] +name = stac_ipyleaflet +version=0.1.0 +author = Aimee Barciauskas +description=ipyleaflet customized for discovering, visualizing and interacting with STAC and workspace data. +long_description = file: README.md +url = https://github.com/abarciauskas-bgse/stac_ipyleaflet +keywords = stac_ipyleaflet +author_email=aimee@developmentseed.org +license=MIT license +classifiers = + Development Status :: 2 - Pre-Alpha + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Natural Language :: English + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + [bumpversion] current_version = 0.1.0 commit = True @@ -18,3 +37,30 @@ universal = 1 exclude = docs [tool:pytest] collect_ignore = ['setup.py'] + +[options] +packages = find: +include_package_data=True +zip_safe=False +tests_require=[pytest>=3] +install_requires = + ipyleaflet==0.17.2 + ipywidgets==8.0.4 + ipyevents + matplotlib + pydantic + shapely + rasterio + requests + rio_tiler + rioxarray + xarray + pystac_client==0.6.1 + +[options.extras_require] +test = + pytest + +[options.packages.find] +where = stac_ipyleaflet + diff --git a/setup.py b/setup.py index 1460213..3809795 100644 --- a/setup.py +++ b/setup.py @@ -2,43 +2,7 @@ """The setup script.""" -from setuptools import setup, find_packages +from setuptools import setup -with open('README.rst') as readme_file: - readme = readme_file.read() - -with open('HISTORY.rst') as history_file: - history = history_file.read() - -requirements = [ ] - -test_requirements = ['pytest>=3', ] - -setup( - author="Aimee Barciauskas", - author_email='aimee@developmentseed.org', - python_requires='>=3.6', - classifiers=[ - 'Development Status :: 2 - Pre-Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - ], - description="ipyleaflet customized for discovering, visualizing and interacting with STAC and workspace data.", - install_requires=requirements, - license="MIT license", - long_description=readme + '\n\n' + history, - include_package_data=True, - keywords='stac_ipyleaflet', - name='stac_ipyleaflet', - packages=find_packages(include=['stac_ipyleaflet', 'stac_ipyleaflet.*']), - test_suite='tests', - tests_require=test_requirements, - url='https://github.com/abarciauskas-bgse/stac_ipyleaflet', - version='0.1.0', - zip_safe=False, -) +if __name__ == "__main__": + setup()