From a27ceb68fd85ac52bffa4a7aa3b24ad948d3bfee Mon Sep 17 00:00:00 2001 From: Florence Haudin Date: Tue, 5 Apr 2022 16:55:28 +0200 Subject: [PATCH 1/2] Add a try with JupyterLite in ipyleaflet documentation --- docs/environment.yml | 1 + docs/source/conf.py | 4 +- docs/source/index.rst | 11 ++++++ docs/source/ipyleaflet.ipynb | 58 +++++++++++++++++++++++++++++ docs/source/jupyterlite_config.json | 25 +++++++++++++ docs/source/requirements.txt | 4 ++ docs/test.wkt | 23 ++++++++++++ 7 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 docs/source/ipyleaflet.ipynb create mode 100644 docs/source/jupyterlite_config.json create mode 100644 docs/source/requirements.txt create mode 100644 docs/test.wkt diff --git a/docs/environment.yml b/docs/environment.yml index 0e6f82398..934d76700 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -15,6 +15,7 @@ dependencies: - branca - shapely - pydata-sphinx-theme + - jupyterlite-sphinx - pip: - .. diff --git a/docs/source/conf.py b/docs/source/conf.py index 231738b20..88a4e04d2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- extensions = [ - 'jupyter_sphinx','sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.napoleon','sphinx.ext.todo', 'sphinx.ext.viewcode' + 'jupyter_sphinx', 'jupyterlite_sphinx', 'sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.napoleon','sphinx.ext.todo', 'sphinx.ext.viewcode' ] templates_path = ['_templates'] - +jupyterlite_config = "jupyterlite_config.json" def setup(app): app.add_css_file("main_stylesheet.css") diff --git a/docs/source/index.rst b/docs/source/index.rst index 4a2c840ee..2c0dc1007 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,6 +1,17 @@ ipyleaflet: Interactive maps in the Jupyter notebook ==================================================== + +Try it online +------------- + +You can try ipyleaflet directly in this documentation page thanks to JupyterLite! + +.. retrolite:: ipyleaflet.ipynb + +Index +----- + .. toctree:: :maxdepth: 2 diff --git a/docs/source/ipyleaflet.ipynb b/docs/source/ipyleaflet.ipynb new file mode 100644 index 000000000..d13c6dcfa --- /dev/null +++ b/docs/source/ipyleaflet.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "8eee1995-a52b-4eae-8898-047746e57b19", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "96d863f5de674932843d341778cf17b2", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[48.204793, 350.121558], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from ipyleaflet import Map, basemaps, basemap_to_tiles\n", + "\n", + "m = Map(\n", + " basemap=basemap_to_tiles(basemaps.OpenStreetMap.Mapnik),\n", + " center=(48.204793, 350.121558),\n", + " zoom=3\n", + " )\n", + "\n", + "m" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/source/jupyterlite_config.json b/docs/source/jupyterlite_config.json new file mode 100644 index 000000000..ac84f005e --- /dev/null +++ b/docs/source/jupyterlite_config.json @@ -0,0 +1,25 @@ +{ + "LiteBuildConfig": { + "federated_extensions": [ + "https://github.com/conda-forge/releases/releases/download/noarch/jupyterlab_widgets-1.0.2-pyhd8ed1ab_0.tar.bz2/jupyterlab_widgets-1.0.2-pyhd8ed1ab_0.tar.bz2", + "https://github.com/conda-forge/releases/releases/download/noarch/ipycanvas-0.11.0-pyhd8ed1ab_0.tar.bz2/ipycanvas-0.11.0-pyhd8ed1ab_0.tar.bz2" + ], + "ignore_sys_prefix": true, + "piplite_urls": [ + "https://files.pythonhosted.org/packages/py2.py3/i/ipycanvas/ipycanvas-0.11.0-py2.py3-none-any.whl", + "https://files.pythonhosted.org/packages/py2.py3/i/ipython-genutils/ipython_genutils-0.2.0-py2.py3-none-any.whl", + "https://files.pythonhosted.org/packages/py2.py3/i/ipywidgets/ipywidgets-7.6.5-py2.py3-none-any.whl", + "https://files.pythonhosted.org/packages/py2.py3/r/requests/requests-2.27.1-py2.py3-none-any.whl", + "https://files.pythonhosted.org/packages/py2.py3/t/traittypes/traittypes-0.2.1-py2.py3-none-any.whl", + "https://files.pythonhosted.org/packages/py2.py3/u/urllib3/urllib3-1.26.8-py2.py3-none-any.whl", + "https://files.pythonhosted.org/packages/py3/b/branca/branca-0.4.2-py3-none-any.whl", + "https://files.pythonhosted.org/packages/py3/i/ipython/ipython-8.0.1-py3-none-any.whl", + "https://files.pythonhosted.org/packages/py3/j/jupyter-client/jupyter_client-7.1.2-py3-none-any.whl", + "https://files.pythonhosted.org/packages/py3/j/jupyter-core/jupyter_core-4.9.2-py3-none-any.whl", + "https://files.pythonhosted.org/packages/py3/j/jupyterlab-widgets/jupyterlab_widgets-1.0.2-py3-none-any.whl", + "https://files.pythonhosted.org/packages/py3/n/nest-asyncio/nest_asyncio-1.5.4-py3-none-any.whl", + "https://files.pythonhosted.org/packages/py3/n/notebook/notebook-6.4.8-py3-none-any.whl", + "https://files.pythonhosted.org/packages/py3/t/traitlets/traitlets-5.1.1-py3-none-any.whl" + ] + } +} diff --git a/docs/source/requirements.txt b/docs/source/requirements.txt new file mode 100644 index 000000000..b88659823 --- /dev/null +++ b/docs/source/requirements.txt @@ -0,0 +1,4 @@ +ipyleaflet +sphinx===4.4.0 +jupyterlite-sphinx +pydata-sphinx-theme diff --git a/docs/test.wkt b/docs/test.wkt new file mode 100644 index 000000000..5dc69c293 --- /dev/null +++ b/docs/test.wkt @@ -0,0 +1,23 @@ +MULTIPOLYGON(((-71.1031880899493 42.3152774590236, +-71.1031627617667 42.3152960829043,-71.102923838298 42.3149156848307, +-71.1023097974109 42.3151969047397,-71.1019285062273 42.3147384934248, +-71.102505233663 42.3144722937587,-71.10277487471 42.3141658254797, +-71.103113945163 42.3142739188902,-71.10324876416 42.31402489987, +-71.1033002961013 42.3140393340215,-71.1033488797549 42.3139495090772, +-71.103396240451 42.3138632439557,-71.1041521907712 42.3141153348029, +-71.1041411411543 42.3141545014533,-71.1041287795912 42.3142114839058, +-71.1041188134329 42.3142693656241,-71.1041112482575 42.3143272556118, +-71.1041072845732 42.3143851580048,-71.1041057218871 42.3144430686681, +-71.1041065602059 42.3145009876017,-71.1041097995362 42.3145589148055, +-71.1041166403905 42.3146168544148,-71.1041258822717 42.3146748022936, +-71.1041375307579 42.3147318674446,-71.1041492906949 42.3147711126569, +-71.1041598612795 42.314808571739,-71.1042515013869 42.3151287620809, +-71.1041173835118 42.3150739481917,-71.1040809891419 42.3151344119048, +-71.1040438678912 42.3151191367447,-71.1040194562988 42.3151832057859, +-71.1038734225584 42.3151140942995,-71.1038446938243 42.3151006300338, +-71.1038315271889 42.315094347535,-71.1037393329282 42.315054824985, +-71.1035447555574 42.3152608696313,-71.1033436658644 42.3151648370544, +-71.1032580383161 42.3152269126061,-71.103223066939 42.3152517403219, +-71.1031880899493 42.3152774590236)), +((-71.1043632495873 42.315113108546,-71.1043583974082 42.3151211109857, +-71.1043443253471 42.3150676015829,-71.1043850704575 42.3150793250568,-71.1043632495873 42.315113108546))) \ No newline at end of file From caad52149ff8be8f2d4ce8646f739388f938d55b Mon Sep 17 00:00:00 2001 From: Florence Haudin Date: Tue, 5 Apr 2022 23:43:18 +0200 Subject: [PATCH 2/2] Add a try with JupyterLite in ipyleaflet documentation --- .gitignore | 5 ++-- docs/environment.yml | 5 ++-- docs/source/controls/fullscreen_control.rst | 4 +-- docs/source/controls/measure_control.rst | 4 +-- docs/source/ipyleaflet.ipynb | 31 +++++++++------------ docs/source/jupyterlite_config.json | 4 +-- docs/source/requirements.txt | 4 --- docs/test.wkt | 23 --------------- 8 files changed, 24 insertions(+), 56 deletions(-) delete mode 100644 docs/source/requirements.txt delete mode 100644 docs/test.wkt diff --git a/.gitignore b/.gitignore index 8bb253782..cb004cedd 100644 --- a/.gitignore +++ b/.gitignore @@ -21,10 +21,11 @@ js/jupyter-leaflet-*.tgz docs/*.csv docs/*.json docs/*.nc +docs/test.wkt # Untitled Notebooks *Untitled*.ipynb -#Galata +#Galata ui-test/playwright-report -ui-test/test-results \ No newline at end of file +ui-test/test-results diff --git a/docs/environment.yml b/docs/environment.yml index 934d76700..c84b7ccc5 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -15,8 +15,7 @@ dependencies: - branca - shapely - pydata-sphinx-theme - - jupyterlite-sphinx + - pip: - .. - - + - jupyterlite-sphinx \ No newline at end of file diff --git a/docs/source/controls/fullscreen_control.rst b/docs/source/controls/fullscreen_control.rst index 7009530e0..a18f79bc2 100644 --- a/docs/source/controls/fullscreen_control.rst +++ b/docs/source/controls/fullscreen_control.rst @@ -13,8 +13,8 @@ Example m -Attribute ---------- +Attributes +---------- .. autoclass:: ipyleaflet.leaflet.FullScreenControl :members: diff --git a/docs/source/controls/measure_control.rst b/docs/source/controls/measure_control.rst index 8de23d277..0ab96b5fc 100644 --- a/docs/source/controls/measure_control.rst +++ b/docs/source/controls/measure_control.rst @@ -28,8 +28,8 @@ Example m -Attributes and methods ----------------------- +Attributes +---------- .. autoclass:: ipyleaflet.leaflet.MeasureControl :members: \ No newline at end of file diff --git a/docs/source/ipyleaflet.ipynb b/docs/source/ipyleaflet.ipynb index d13c6dcfa..6ef785424 100644 --- a/docs/source/ipyleaflet.ipynb +++ b/docs/source/ipyleaflet.ipynb @@ -2,25 +2,21 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "8eee1995-a52b-4eae-8898-047746e57b19", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "96d863f5de674932843d341778cf17b2", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[48.204793, 350.121558], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title'…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], + "source": [ + "import piplite\n", + "await piplite.install('ipyleaflet')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dbabb8a7", + "metadata": {}, + "outputs": [], "source": [ "from ipyleaflet import Map, basemaps, basemap_to_tiles\n", "\n", @@ -29,7 +25,6 @@ " center=(48.204793, 350.121558),\n", " zoom=3\n", " )\n", - "\n", "m" ] } diff --git a/docs/source/jupyterlite_config.json b/docs/source/jupyterlite_config.json index ac84f005e..29a1374b5 100644 --- a/docs/source/jupyterlite_config.json +++ b/docs/source/jupyterlite_config.json @@ -2,11 +2,11 @@ "LiteBuildConfig": { "federated_extensions": [ "https://github.com/conda-forge/releases/releases/download/noarch/jupyterlab_widgets-1.0.2-pyhd8ed1ab_0.tar.bz2/jupyterlab_widgets-1.0.2-pyhd8ed1ab_0.tar.bz2", - "https://github.com/conda-forge/releases/releases/download/noarch/ipycanvas-0.11.0-pyhd8ed1ab_0.tar.bz2/ipycanvas-0.11.0-pyhd8ed1ab_0.tar.bz2" + "https://github.com/conda-forge/releases/releases/download/noarch/ipyleaflet-0.15.0-pyhd8ed1ab_3.tar.bz2/ipyleaflet-0.15.0-pyhd8ed1ab_3.tar.bz2" ], "ignore_sys_prefix": true, "piplite_urls": [ - "https://files.pythonhosted.org/packages/py2.py3/i/ipycanvas/ipycanvas-0.11.0-py2.py3-none-any.whl", + "https://files.pythonhosted.org/packages/py2.py3/i/ipyleaflet/ipyleaflet-0.15.0-py2.py3-none-any.whl", "https://files.pythonhosted.org/packages/py2.py3/i/ipython-genutils/ipython_genutils-0.2.0-py2.py3-none-any.whl", "https://files.pythonhosted.org/packages/py2.py3/i/ipywidgets/ipywidgets-7.6.5-py2.py3-none-any.whl", "https://files.pythonhosted.org/packages/py2.py3/r/requests/requests-2.27.1-py2.py3-none-any.whl", diff --git a/docs/source/requirements.txt b/docs/source/requirements.txt deleted file mode 100644 index b88659823..000000000 --- a/docs/source/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -ipyleaflet -sphinx===4.4.0 -jupyterlite-sphinx -pydata-sphinx-theme diff --git a/docs/test.wkt b/docs/test.wkt deleted file mode 100644 index 5dc69c293..000000000 --- a/docs/test.wkt +++ /dev/null @@ -1,23 +0,0 @@ -MULTIPOLYGON(((-71.1031880899493 42.3152774590236, --71.1031627617667 42.3152960829043,-71.102923838298 42.3149156848307, --71.1023097974109 42.3151969047397,-71.1019285062273 42.3147384934248, --71.102505233663 42.3144722937587,-71.10277487471 42.3141658254797, --71.103113945163 42.3142739188902,-71.10324876416 42.31402489987, --71.1033002961013 42.3140393340215,-71.1033488797549 42.3139495090772, --71.103396240451 42.3138632439557,-71.1041521907712 42.3141153348029, --71.1041411411543 42.3141545014533,-71.1041287795912 42.3142114839058, --71.1041188134329 42.3142693656241,-71.1041112482575 42.3143272556118, --71.1041072845732 42.3143851580048,-71.1041057218871 42.3144430686681, --71.1041065602059 42.3145009876017,-71.1041097995362 42.3145589148055, --71.1041166403905 42.3146168544148,-71.1041258822717 42.3146748022936, --71.1041375307579 42.3147318674446,-71.1041492906949 42.3147711126569, --71.1041598612795 42.314808571739,-71.1042515013869 42.3151287620809, --71.1041173835118 42.3150739481917,-71.1040809891419 42.3151344119048, --71.1040438678912 42.3151191367447,-71.1040194562988 42.3151832057859, --71.1038734225584 42.3151140942995,-71.1038446938243 42.3151006300338, --71.1038315271889 42.315094347535,-71.1037393329282 42.315054824985, --71.1035447555574 42.3152608696313,-71.1033436658644 42.3151648370544, --71.1032580383161 42.3152269126061,-71.103223066939 42.3152517403219, --71.1031880899493 42.3152774590236)), -((-71.1043632495873 42.315113108546,-71.1043583974082 42.3151211109857, --71.1043443253471 42.3150676015829,-71.1043850704575 42.3150793250568,-71.1043632495873 42.315113108546))) \ No newline at end of file