diff --git a/.github/workflows/build-for-docker.yml b/.github/workflows/build-for-docker.yml new file mode 100644 index 0000000..bad69b9 --- /dev/null +++ b/.github/workflows/build-for-docker.yml @@ -0,0 +1,25 @@ +name: Test environment for Docker + +on: workflow_dispatch + +jobs: + runtests: + name: "Set up environment" + runs-on: "ubuntu-20.04" + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + miniconda-version: 'latest' + channels: conda-forge + channel-priority: true + auto-update-conda: false + auto-activate-base: false + environment-file: environment.yml + activate-environment: earth-analytics-python + - run: conda list + - run: python -c "import earthpy" + - run: python -c "import rasterio" diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml deleted file mode 100644 index f414b9b..0000000 --- a/.github/workflows/build-image.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This build will only build the image on any branch (besides main) where there is a push -name: Build Docker Image - -on: - push: - branches: - - '*' - - '!main' - -jobs: - build-image: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Build Image - id: docker_build - uses: docker/build-push-action@v2 - with: - context: ./ - file: ./Dockerfile - push: false - tags: earthlab/r-python-eds-lessons-env:latest - - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/build-push-image.yml b/.github/workflows/build-push-image.yml index af3f644..56d44ac 100644 --- a/.github/workflows/build-push-image.yml +++ b/.github/workflows/build-push-image.yml @@ -1,10 +1,8 @@ # This build will build and push the image to docker hub upon a commit to the # main branch only -name: Push to Docker Hub from Main Branch +name: Push to Docker Hub -on: - push: - branches: main +on: workflow_dispatch jobs: build-push-image: @@ -21,12 +19,12 @@ jobs: - name: Build and push image id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5.1.0 with: context: ./ file: ./Dockerfile push: true - tags: earthlab/r-python-eds-lessons-env:latest + tags: earthlab/earth-analytics-python-env:latest - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/build-test-envt.yml b/.github/workflows/build-test-envt.yml index 961ac5c..e14957c 100644 --- a/.github/workflows/build-test-envt.yml +++ b/.github/workflows/build-test-envt.yml @@ -1,16 +1,6 @@ -# This workflow runs tests for earthpy -# Because we want a conda environment - and that builds slower, -# we divided up tests from linting and docs to make for simpler install envts - name: Test EA Python Envt Mac, Linux, Windows -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' +on: workflow_dispatch jobs: runtests: @@ -19,21 +9,24 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "macos-latest", "windows-latest"] + os: + - "ubuntu-latest" + - "macos-13" + - "macos-latest" + - "windows-latest" defaults: run: - shell: bash -l {0} + shell: bash -el {0} steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/checkout@v4.1.7 + with: + ref: ${{ github.head_ref || github.ref_name }} + - uses: conda-incubator/setup-miniconda@v3.0.4 with: - miniconda-version: 'latest' - channels: conda-forge - channel-priority: true - auto-update-conda: false auto-activate-base: false environment-file: environment.yml activate-environment: earth-analytics-python - run: conda list - run: python -c "import earthpy" - - run: python -c "import rasterio" + - run: python -c "import geopandas" + - run: python -c "import rioxarray" diff --git a/Dockerfile b/Dockerfile index ffe8187..530052c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,33 @@ -FROM jupyter/minimal-notebook +FROM jupyter/minimal-notebook:python-3.11 -MAINTAINER Leah Wasser +# Installing package for libmamba +USER root +RUN apt-get update && \ + apt-get install -y \ + libfmt-dev \ + libtiff5 -COPY environment.yml environment.yml +USER jovyan -RUN conda env update --name base --file environment.yml \ - && conda info --envs \ - && conda list \ - && rm environment.yml +# Set up conda +RUN conda update conda +RUN conda config --remove channels conda-forge +RUN conda config --add channels conda-forge +#RUN conda config --set channel_priority strict +#RUN conda config --set solver classic -ENV PROJ_LIB $CONDA_DIR/share/proj +# Create environment +COPY environment.yml /home/jovyan/ +RUN conda install -n base -c conda-forge mamba +RUN mamba env update -n base -f /home/jovyan/environment.yml -# Test imports -RUN python -c "import rasterio" -RUN python -c "import earthpy" +# Activating environment +RUN echo ". /opt/conda/etc/profile.d/conda.sh" >> /home/jovyan/.bash_profile && \ + echo "conda deactivate" >> /home/jovyan/.bash_profile && \ + echo "conda activate base" >> /home/jovyan/.bash_profile +RUN . /opt/conda/etc/profile.d/conda.sh && conda activate base && python -m ipykernel install --user --name base +# using ~/.bash_profile instead of ~/.bashrc for non-interactive tty (-it) containers +RUN source /home/jovyan/.bash_profile + +# Install dev version of Earthpy +RUN pip install git+https://github.com/earthlab/earthpy@main diff --git a/environment.yml b/environment.yml index 32402e0..d495389 100644 --- a/environment.yml +++ b/environment.yml @@ -4,55 +4,78 @@ channels: - defaults dependencies: - - python=3.8 + - python=3.11 - pip + # Core scientific python - numpy - - pyqt - - tqdm - - kiwisolver - - # Plotting - - matplotlib - - plotly - - seaborn + - pandas + - scipy + - dask - # Spatial packages - - pysal + # Geospatial libraries + # Coordinates and CRSs - pyproj>=3.0 - - rasterstats - geopy - cartopy - - descartes - - contextily - - earthpy - - folium + # Vector data + - geopandas - geojson - - mapboxgl - - hydrofunctions - - geocoder - - tweepy + - pyogrio + # Raster data - xarray - - rioxarray>=0.3.0 - - scipy + - h5py - netcdf4 - - nc-time-axis + - rioxarray>=0.3.0 + - xarray-spatial - regionmask - - # Natural language processing - - nltk - - textblob - - # Jupyter Environment - - papermill - - autopep8 + + # Interactive computing + - ipython - jupyterlab - notebook - - ipython - - jupyter_contrib_nbextensions - - nbclean + - tqdm - nbresuse + - papermill + - nbclean - # Autograding - - matplotcheck>=0.1.3 - - nbgrader + # ML and modeling + - scikit-learn + - scikit-fuzzy + + # Data access + - earthpy + - earthaccess + - pystac-client + - adlfs + - dataretrieval + - osmnx + + # Plotting + # Matplotlib + - matplotlib + - nc-time-axis + - descartes + - contextily + - seaborn + # Holoviews + # --- Avoid compatibility issues with bokeh and new holoviews + - holoviews<=1.19 + - hvplot + - geoviews>=1.10 + - selenium + - phantomjs + - jupyter_bokeh + # Folium + - folium + + # QA + - flake8 + - flake8-import-order + - black + - autopep8 + - pydocstyle + - nbqa + + - pip: + - pygbif