From 129129113334a1de9d10647ae5abf2db08534bea Mon Sep 17 00:00:00 2001 From: Jeroen Minderman Date: Thu, 8 Jun 2023 14:32:24 +0100 Subject: [PATCH 1/5] Added boilerplate devcontainter --- .devcontainer/Dockerfile | 30 ++++++++++++++++++ .devcontainer/devcontainer.json | 55 +++++++++++++++++++++++++++++++++ .devcontainer/requirements.txt | 14 +++++++++ 3 files changed, 99 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/requirements.txt diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..7b9cd8b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,30 @@ +# Pre-built Dev Container Image for R. More info: https://github.com/rocker-org/devcontainer-images/pkgs/container/devcontainer%2Ftidyverse +# Available R version: 4, 4.1, 4.0 +ARG VARIANT="4.2" +FROM ghcr.io/rocker-org/devcontainer/tidyverse:${VARIANT} + +RUN install2.r --error --skipinstalled -n -1 \ + statip \ + patchwork \ + paletteer \ + here \ + doParallel \ + janitor \ + vip \ + ranger \ + palmerpenguins \ + skimr \ + nnet \ + kernlab \ + plotly \ + factoextra \ + cluster \ + tidymodels \ + markdown \ + ottr \ + && rm -rf /tmp/downloaded_packages \ + && R -q -e 'remotes::install_github("https://github.com/dcomtois/summarytools/tree/0-8-9")' + +# Install Python packages +COPY requirements.txt /tmp/pip-tmp/ +RUN python3 -m pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..f49ddf9 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,55 @@ +{ + "name": "R Data Science Environment", + "build": { + "dockerfile": "Dockerfile", + // Update VARIANT to pick a specific R version: 4, 4.1, 4.0 + // More info: https://github.com/rocker-org/devcontainer-images/pkgs/container/devcontainer%2Ftidyverse + "args": { "VARIANT": "4" } + }, + + // Install Dev Container Features. More info: https://containers.dev/features + "features": { + "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {}, + // Install JupyterLab and IRkernel. + // More info: https://github.com/rocker-org/devcontainer-templates/tree/main/src/r-ver + "ghcr.io/rocker-org/devcontainer-features/r-rig:1": { + "version": "none", + "installJupyterlab": true + } + }, + + "customizations": { + "vscode": { + "extensions": [ + // Add Jupyter and Python vscode extensions + "ms-toolsai.jupyter", + "ms-toolsai.jupyter-renderers", + "ms-python.python", + "ms-python.vscode-pylance", + "vsls-contrib.codetour", + "GitHub.copilot" + ] + } + }, + + // Forward Jupyter and RStudio ports + "forwardPorts": [8787, 8888], + "portsAttributes": { + "8787": { + "label": "Rstudio", + "requireLocalPort": true, + "onAutoForward": "ignore" + }, + "8888": { + "label": "Jupyter", + "requireLocalPort": true, + "onAutoForward": "ignore" + } + }, + + // Use 'postAttachCommand' to run commands after the container is started. + "postAttachCommand": "sudo rstudio-server start" + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root + // "remoteUser": "root" +} diff --git a/.devcontainer/requirements.txt b/.devcontainer/requirements.txt new file mode 100644 index 0000000..f74186d --- /dev/null +++ b/.devcontainer/requirements.txt @@ -0,0 +1,14 @@ +pybryt +pylint +datascience +otter-grader +numpy +pandas +scipy +folium>=0.9.1 +matplotlib +ipywidgets>=7.0.0 +bqplot +nbinteract>=0.0.12 +okpy +scikit-learn From 93191d9fb55c2adb4daf1c35af41d2137a1134ce Mon Sep 17 00:00:00 2001 From: Jeroen Minderman <92802608+jeroenminderman@users.noreply.github.com> Date: Thu, 8 Jun 2023 14:08:50 +0000 Subject: [PATCH 2/5] Adding low-level library setup of geo analysis as well as additional Python requirements --- .devcontainer/Dockerfile | 28 +++++++--------------------- .devcontainer/requirements2.txt | 7 +++++++ 2 files changed, 14 insertions(+), 21 deletions(-) create mode 100644 .devcontainer/requirements2.txt diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7b9cd8b..9c7f274 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,27 +3,13 @@ ARG VARIANT="4.2" FROM ghcr.io/rocker-org/devcontainer/tidyverse:${VARIANT} -RUN install2.r --error --skipinstalled -n -1 \ - statip \ - patchwork \ - paletteer \ - here \ - doParallel \ - janitor \ - vip \ - ranger \ - palmerpenguins \ - skimr \ - nnet \ - kernlab \ - plotly \ - factoextra \ - cluster \ - tidymodels \ - markdown \ - ottr \ - && rm -rf /tmp/downloaded_packages \ - && R -q -e 'remotes::install_github("https://github.com/dcomtois/summarytools/tree/0-8-9")' +RUN apt-get install software-properties-common \ + && add-apt-repository ppa:ubuntugis/ppa -y + +RUN apt-get update + +RUN apt-get install gdal-bin -y \ + && apt-get install libgdal-dev -y # Install Python packages COPY requirements.txt /tmp/pip-tmp/ diff --git a/.devcontainer/requirements2.txt b/.devcontainer/requirements2.txt new file mode 100644 index 0000000..c305297 --- /dev/null +++ b/.devcontainer/requirements2.txt @@ -0,0 +1,7 @@ +Rtree +GDAL +Fiona +pyproj +Shapely +geopandas +mapclassify \ No newline at end of file From a1b760bd1733ce2a7d8fd0bc88fdad1d9be9fbeb Mon Sep 17 00:00:00 2001 From: Jeroen Minderman <92802608+jeroenminderman@users.noreply.github.com> Date: Thu, 8 Jun 2023 14:15:06 +0000 Subject: [PATCH 3/5] Debugging Dockerfile --- .devcontainer/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9c7f274..a46c02f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,13 +3,13 @@ ARG VARIANT="4.2" FROM ghcr.io/rocker-org/devcontainer/tidyverse:${VARIANT} -RUN apt-get install software-properties-common \ - && add-apt-repository ppa:ubuntugis/ppa -y +#RUN apt-get install software-properties-common \ +# && add-apt-repository ppa:ubuntugis/ppa -y -RUN apt-get update +#RUN apt-get update -RUN apt-get install gdal-bin -y \ - && apt-get install libgdal-dev -y +#RUN apt-get install gdal-bin -y \ +# && apt-get install libgdal-dev -y # Install Python packages COPY requirements.txt /tmp/pip-tmp/ From f58ff00ca027cc1a5a1e2ee620580226379bb0a7 Mon Sep 17 00:00:00 2001 From: Jeroen Minderman <92802608+jeroenminderman@users.noreply.github.com> Date: Thu, 8 Jun 2023 14:25:56 +0000 Subject: [PATCH 4/5] Updating Dockerfile, .devcontainer.json, requirements.txt as required for Python geo libraries. --- .devcontainer/Dockerfile | 26 +++++++++++++++++++++----- .devcontainer/devcontainer.json | 31 ++++++++++--------------------- .devcontainer/requirements.txt | 8 ++++++++ .devcontainer/requirements2.txt | 3 ++- 4 files changed, 41 insertions(+), 27 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a46c02f..a5d440e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,13 +3,29 @@ ARG VARIANT="4.2" FROM ghcr.io/rocker-org/devcontainer/tidyverse:${VARIANT} -#RUN apt-get install software-properties-common \ -# && add-apt-repository ppa:ubuntugis/ppa -y +RUN apt-get update && apt-get install -y --no-install-recommends \ + software-properties-common \ + libudunits2-dev \ + libgdal-dev \ + libgeos-dev \ + libproj-dev -#RUN apt-get update +RUN add-apt-repository ppa:ubuntugis/ppa -y \ + && apt-get install -y --no-install-recommends gdal-bin -#RUN apt-get install gdal-bin -y \ -# && apt-get install libgdal-dev -y +RUN pip uninstall Jinja2 + +#RUN apt-get update && apt-get install -y \ +# && software-properties-common +# && libudunits2-dev \ +# && libgdal-dev \ +# && libgeos-dev \ +# && libproj-dev +# #&& add-apt-repository ppa:ubuntugis/ppa + +#RUN apt-get update \ +# && apt-get install -y --no-install-recommends \ +# && apt-get install gdal-bin # Install Python packages COPY requirements.txt /tmp/pip-tmp/ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f49ddf9..3b0fc86 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,17 +7,6 @@ "args": { "VARIANT": "4" } }, - // Install Dev Container Features. More info: https://containers.dev/features - "features": { - "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {}, - // Install JupyterLab and IRkernel. - // More info: https://github.com/rocker-org/devcontainer-templates/tree/main/src/r-ver - "ghcr.io/rocker-org/devcontainer-features/r-rig:1": { - "version": "none", - "installJupyterlab": true - } - }, - "customizations": { "vscode": { "extensions": [ @@ -25,21 +14,21 @@ "ms-toolsai.jupyter", "ms-toolsai.jupyter-renderers", "ms-python.python", - "ms-python.vscode-pylance", - "vsls-contrib.codetour", - "GitHub.copilot" + "ms-python.vscode-pylance" + //"vsls-contrib.codetour", + //"GitHub.copilot" ] } }, // Forward Jupyter and RStudio ports - "forwardPorts": [8787, 8888], + "forwardPorts": [8888], "portsAttributes": { - "8787": { - "label": "Rstudio", - "requireLocalPort": true, - "onAutoForward": "ignore" - }, + //"8787": { + // "label": "Rstudio", + // "requireLocalPort": true, + // "onAutoForward": "ignore" + //}, "8888": { "label": "Jupyter", "requireLocalPort": true, @@ -48,7 +37,7 @@ }, // Use 'postAttachCommand' to run commands after the container is started. - "postAttachCommand": "sudo rstudio-server start" + //"postAttachCommand": "sudo rstudio-server start" // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root // "remoteUser": "root" diff --git a/.devcontainer/requirements.txt b/.devcontainer/requirements.txt index f74186d..f4a287b 100644 --- a/.devcontainer/requirements.txt +++ b/.devcontainer/requirements.txt @@ -12,3 +12,11 @@ bqplot nbinteract>=0.0.12 okpy scikit-learn +Rtree +GDAL +Fiona +pyproj +Shapely +geopandas +mapclassify +jupyter diff --git a/.devcontainer/requirements2.txt b/.devcontainer/requirements2.txt index c305297..8b485c5 100644 --- a/.devcontainer/requirements2.txt +++ b/.devcontainer/requirements2.txt @@ -4,4 +4,5 @@ Fiona pyproj Shapely geopandas -mapclassify \ No newline at end of file +mapclassify +notebook \ No newline at end of file From 21be1b832f3b4b00a3beae0cdb5c47ec312c0a89 Mon Sep 17 00:00:00 2001 From: Jeroen Minderman Date: Fri, 9 Jun 2023 16:03:45 +0100 Subject: [PATCH 5/5] Cleaning up stray comments in Dockerfile, removing extraneous requirements file, now included in requirements.txt --- .devcontainer/Dockerfile | 12 ------------ .devcontainer/requirements2.txt | 8 -------- 2 files changed, 20 deletions(-) delete mode 100644 .devcontainer/requirements2.txt diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a5d440e..0eff9b7 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -15,18 +15,6 @@ RUN add-apt-repository ppa:ubuntugis/ppa -y \ RUN pip uninstall Jinja2 -#RUN apt-get update && apt-get install -y \ -# && software-properties-common -# && libudunits2-dev \ -# && libgdal-dev \ -# && libgeos-dev \ -# && libproj-dev -# #&& add-apt-repository ppa:ubuntugis/ppa - -#RUN apt-get update \ -# && apt-get install -y --no-install-recommends \ -# && apt-get install gdal-bin - # Install Python packages COPY requirements.txt /tmp/pip-tmp/ RUN python3 -m pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt diff --git a/.devcontainer/requirements2.txt b/.devcontainer/requirements2.txt deleted file mode 100644 index 8b485c5..0000000 --- a/.devcontainer/requirements2.txt +++ /dev/null @@ -1,8 +0,0 @@ -Rtree -GDAL -Fiona -pyproj -Shapely -geopandas -mapclassify -notebook \ No newline at end of file