Skip to content

Commit 88576d8

Browse files
committed
Merge branch 'master' into NA/guides_11
2 parents 8bd22f6 + 4a7cf48 commit 88576d8

13 files changed

+6873
-328
lines changed

docker/NotebookImage.Dockerfile

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
ARG python_version="3.11"
2-
FROM quay.io/jupyter/base-notebook:python-${python_version}
2+
FROM quay.io/jupyter/minimal-notebook:python-${python_version}
33

44
ARG python_version
5-
ARG arcgis_version="2.3.1"
5+
ARG arcgis_version="2.4.0"
66
ARG sampleslink="https://github.com/Esri/arcgis-python-api/releases/download/v${arcgis_version}/samples.zip"
77
ARG githubfolder="arcgis-python-api"
8-
ENV DOCKER_STACKS_JUPYTER_CMD="notebook"
8+
ARG env_name=arcgis
99

1010
LABEL org.opencontainers.image.authors="[email protected]"
11-
LABEL org.opencontainers.image.description="Jupyter Notebook with the latest version of the ArcGIS API for Python and its Linux dependencies preinstalled"
11+
LABEL org.opencontainers.image.description="Jupyter environment preconfigured for ArcGIS API for Python"
1212
LABEL org.opencontainers.image.licenses=Apache
1313
LABEL org.opencontainers.image.source=https://github.com/Esri/arcgis-python-api
1414

15-
USER root
16-
17-
RUN apt-get update --yes && \
18-
apt-get install --yes --no-install-recommends unzip && \
19-
apt-get clean && rm -rf /var/lib/apt/lists/*
20-
2115
USER ${NB_UID}
2216

2317
# Install Python API from Conda
24-
RUN conda install -c esri arcgis=${arcgis_version} -y \
18+
RUN conda create -n ${env_name} -c esri -c defaults arcgis=${arcgis_version} python=${python_version} -y --quiet --override-channels \
2519
&& conda clean --all -f -y \
2620
&& find /opt/conda -name __pycache__ -type d -exec rm -rf {} +
2721

22+
# Install arcgis-mapping if arcgis_version >= 2.4.0
23+
RUN (dpkg --compare-versions $arcgis_version ge 2.4.0 \
24+
&& conda install -n ${env_name} -c esri -c defaults arcgis-mapping -y --quiet --override-channels \
25+
&& conda clean --all -f -y \
26+
&& find /opt/conda -name __pycache__ -type d -exec rm -rf {} +;) \
27+
|| echo "[INFO] Skipped installing arcgis-mapping for version $arcgis_version (>= 2.4.0 required for arcgis-mapping)"
28+
2829
# Fetch and extract samples from GitHub
2930
RUN mkdir /home/${NB_USER}/$githubfolder && \
3031
wget -O samples.zip $sampleslink \
@@ -36,7 +37,34 @@ RUN mkdir /home/${NB_USER}/$githubfolder && \
3637
work/ \
3738
talks/ \
3839
environment.yml\
40+
# remove .DS_Store and __MACOSX from home directory:
41+
&& find /home/${NB_USER} -name ".DS_Store" -delete \
42+
&& rm -rf /home/${NB_USER}/__MACOSX \
3943
&& fix-permissions /home/${NB_USER}
4044

41-
RUN rm /opt/conda/lib/python${python_version}/site-packages/notebook/static/base/images/logo.png
42-
COPY --chown=${NB_USER}:users jupyter_esri_logo.png /opt/conda/lib/python${python_version}/site-packages/notebook/static/base/images/logo.png
45+
# See https://jupyter-docker-stacks.readthedocs.io/en/latest/using/recipes.html#add-a-custom-conda-environment-and-jupyter-kernel
46+
# Create Python kernel and link it to jupyter
47+
RUN "${CONDA_DIR}/envs/${env_name}/bin/python" -m ipykernel install --user --name="${env_name}" && \
48+
fix-permissions "${CONDA_DIR}" && \
49+
fix-permissions "/home/${NB_USER}"
50+
51+
52+
# More information here: https://github.com/jupyter/docker-stacks/pull/2047
53+
USER root
54+
55+
# Set DOCKER_STACKS_JUPYTER_CMD to "notebook" for versions less than 2.4.0
56+
RUN \
57+
(dpkg --compare-versions $arcgis_version lt 2.4.0 \
58+
&& echo 'DOCKER_STACKS_JUPYTER_CMD="notebook"' >> /etc/environment \
59+
&& echo "[INFO] Set DOCKER_STACKS_JUPYTER_CMD to notebook for arcgis < 2.4.0") \
60+
|| echo "[INFO] Using default DOCKER_STACKS_JUPYTER_CMD (lab) for arcgis >= 2.4.0"
61+
62+
RUN \
63+
# This changes a startup hook, which will activate the custom environment for the process
64+
echo conda activate "${env_name}" >> /usr/local/bin/before-notebook.d/10activate-conda-env.sh && \
65+
# This makes the custom environment default in Jupyter Terminals for all users which might be created later
66+
echo conda activate "${env_name}" >> /etc/skel/.bashrc && \
67+
# This makes the custom environment default in Jupyter Terminals for already existing NB_USER
68+
echo conda activate "${env_name}" >> "/home/${NB_USER}/.bashrc"
69+
70+
USER ${NB_UID}

guide/02-api-overview/deprecation-notices.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"- `Swipe.edit` - deprecated in **2.4.0** removed in future major release. Use the `content` property setter instead.\n",
2929
"- `MapAction` - deprecated in **2.4.0** removed in future major release. Use the `MediaAction` class instead.\n",
3030
"- `JournalStoryMap` - deprecated in **2.0.0** removed in **2.4.0**. Template was removed from the ArcGIS platform.\n",
31+
"- `Hub.initiatives` - deprecated in **2.4.0** removed in a future release. Use `Hub.sites` instead.\n",
3132
"\n",
3233
"\n",
3334
"### `arcgis.learn` Module\n",
@@ -189,7 +190,7 @@
189190
"name": "python",
190191
"nbconvert_exporter": "python",
191192
"pygments_lexer": "ipython3",
192-
"version": "3.10.14"
193+
"version": "3.11.5"
193194
}
194195
},
195196
"nbformat": 4,

guide/03-the-gis/managing-your-gis-servers.ipynb

Lines changed: 2126 additions & 1 deletion
Large diffs are not rendered by default.

guide/10-mapping-and-visualization/part2_navigating_the_map_widget.ipynb

Lines changed: 1742 additions & 1 deletion
Large diffs are not rendered by default.

samples/03_org_administrators/validate_item_metadata.ipynb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"\n",
4949
"import pandas as pd\n",
5050
"\n",
51-
"from arcgis.gis import GIS"
51+
"from arcgis.gis import GIS, ItemTypeEnum, ItemProperties"
5252
]
5353
},
5454
{
@@ -466,7 +466,19 @@
466466
}
467467
],
468468
"source": [
469-
"gis.content.add({}, output_dir + out_file)"
469+
"root_folder = gis.content.folders.get()\n",
470+
"\n",
471+
"new_item_props = ItemProperties(\n",
472+
" \"title\":out_file,\n",
473+
" \"type\":ItemTypeEnum.CSV.value,\n",
474+
" \"tags\":\"item_metatdata_report\",\n",
475+
" \"snippet\":\"Report on item attributes from API\"\n",
476+
")\n",
477+
"\n",
478+
"root_folder.add(\n",
479+
" item_properties=new_item_props,\n",
480+
" file=os.path.join(output_dir + out_file)\n",
481+
").result()"
470482
]
471483
},
472484
{
@@ -516,7 +528,7 @@
516528
"name": "python",
517529
"nbconvert_exporter": "python",
518530
"pygments_lexer": "ipython3",
519-
"version": "3.7.16"
531+
"version": "3.11.0"
520532
},
521533
"toc": {
522534
"base_numbering": 1,
@@ -533,5 +545,5 @@
533545
}
534546
},
535547
"nbformat": 4,
536-
"nbformat_minor": 2
548+
"nbformat_minor": 4
537549
}

samples/03_org_administrators/validate_user_profiles.ipynb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"\n",
4545
"import pandas as pd\n",
4646
"\n",
47-
"from arcgis.gis import GIS"
47+
"from arcgis.gis import GIS, ItemPropertie, ItemTypeEnum"
4848
]
4949
},
5050
{
@@ -281,7 +281,19 @@
281281
}
282282
],
283283
"source": [
284-
"gis.content.add({}, output_dir + out_file)"
284+
"item_props = ItemProperties(\n",
285+
" \"title\" = out_file,\n",
286+
" \"type\" = ItemTypeEnum.CSV,\n",
287+
" \"tags\" = \"user_profile_report\",\n",
288+
" \"snippet\" = \"Report on user profile data from Python API\"\n",
289+
")\n",
290+
"\n",
291+
"root_folder = gis.content.folders.get()\n",
292+
"\n",
293+
"gis.content.add(\n",
294+
" item_properties = item_props,\n",
295+
" file= os.path.join(output_dir + out_file)\n",
296+
").result()"
285297
]
286298
},
287299
{
@@ -331,7 +343,7 @@
331343
"name": "python",
332344
"nbconvert_exporter": "python",
333345
"pygments_lexer": "ipython3",
334-
"version": "3.7.16"
346+
"version": "3.11.0"
335347
},
336348
"toc": {
337349
"base_numbering": 1,
@@ -348,5 +360,5 @@
348360
}
349361
},
350362
"nbformat": 4,
351-
"nbformat_minor": 2
363+
"nbformat_minor": 4
352364
}

samples/04_gis_analysts_data_scientists/automate_building_footprint_extraction_using_instance_segmentation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@
374374
"cell_type": "markdown",
375375
"metadata": {},
376376
"source": [
377-
"`arcgis.learn` provides the MaskRCNN model for instance segmentation tasks, which is based on a pretrained convnet, like ResNet that acts as the 'backbone'. More details about MaskRCNN can be found [here](https://github.com/Esri/arcgis-python-api/blob/master/guide/14-deep-learning/How_MaskRCNN_works.ipynb)."
377+
"`arcgis.learn` provides the MaskRCNN model for instance segmentation tasks, which is based on a pretrained convnet, like ResNet that acts as the 'backbone'. More details about MaskRCNN can be found [here](https://github.com/Esri/arcgis-python-api/blob/master/guide/14-deep-learning/how_maskrcnn_works.ipynb)."
378378
]
379379
},
380380
{

samples/04_gis_analysts_data_scientists/detecting-deforestation-using-kmeans-clustering-on-sentinel-imagery.ipynb

Lines changed: 1189 additions & 1 deletion
Large diffs are not rendered by default.

samples/04_gis_analysts_data_scientists/finding_suitable_spots_for_AED_devices_using_raster_analytics.ipynb

Lines changed: 1442 additions & 1 deletion
Large diffs are not rendered by default.

samples/04_gis_analysts_data_scientists/part2_explore_hurricane_tracks.ipynb

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)