Skip to content

Commit dd5c7f9

Browse files
Nour-Cheour10github-actions[bot]martinRenou
authored
Add documentation and tests (#34)
* add python tests * added doc * added notebooks * jupyter lite in progresss * added test notebooks * change notebooks * notebooks * Heatmap notebooks * change te title in docs * added notebooks examples for github * jupyter lite + python block for geotiff * Delete jupyter lite files * remove jupyter lite file * deteled extra file * fixed doc * documentation improved * Update Playwright Snapshots * Iterate on the docs and the jupyterlite build * Iterate * Rework docs * Iterate * Iterate * Pin Python * Update Playwright Snapshots * More gentle test * Add action to build the docs * Fix package name * Fix default shell + deps --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: martinRenou <[email protected]>
1 parent 0c21a18 commit dd5c7f9

File tree

87 files changed

+3633
-477
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+3633
-477
lines changed

Diff for: .github/workflows/build.yml

+18
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
pull_request:
77
branches: '*'
88

9+
defaults:
10+
run:
11+
shell: bash -l {0}
12+
913
jobs:
1014
build:
1115
runs-on: ${{ matrix.os }}
@@ -40,6 +44,20 @@ jobs:
4044
name: dist ${{ github.run_number }}
4145
path: ./dist
4246

47+
build-docs:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v3
52+
53+
- uses: mamba-org/setup-micromamba@v1
54+
with:
55+
environment-file: docs/build-environment.yml
56+
57+
- name: Build
58+
run: sphinx-build . output
59+
working-directory: docs
60+
4361
visual-regression-tests:
4462
runs-on: ubuntu-latest
4563
needs: [build]

Diff for: .gitignore

+13-4
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ instance/
6161

6262
# Sphinx documentation
6363
docs/_build/
64-
docs/source/_static/
65-
docs/source/_static/embed-bundle.js
66-
docs/source/_static/embed-bundle.js.map
64+
docs/_static/
65+
docs/_static/embed-bundle.js
66+
docs/_static/embed-bundle.js.map
67+
docs/build
68+
docs/output
69+
docs/jupyter_execute
70+
6771

6872
# PyBuilder
6973
target/
@@ -159,8 +163,13 @@ package-lock.json
159163
# Packed lab extensions
160164
ipyopenlayers/labextension
161165
ipyopenlayers/nbextension
162-
163166
!ipyopenlayers/nbextension/extension.js
164167

165168

166169
.yarn
170+
.vscode/
171+
172+
#jupyter lite
173+
.jupyterlite.doit.db
174+
lite_build_output/dist
175+
lite_build_output/.jupyterlite.doit.db

Diff for: docs/Makefile

-20
This file was deleted.

Diff for: docs/api_reference/index.rst

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
API Reference
2+
=============
3+
4+
.. automodule:: ipyopenlayers.openlayers
5+
:members:

Diff for: docs/build-environment.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: ipyopenlayers-docs
2+
3+
channels:
4+
- conda-forge
5+
6+
dependencies:
7+
- yarn~=3.0
8+
- jupyterlab~=4.0
9+
- jupyter-packaging~=0.12
10+
- sphinx
11+
- jupyter-sphinx
12+
- nbsphinx
13+
- nbsphinx-link
14+
- python-build
15+
- branca
16+
- requests
17+
- hatch
18+
- pydata-sphinx-theme
19+
- jupyterlite-sphinx
20+
- jupyterlite-xeus
21+
- pip:
22+
- ..

Diff for: docs/source/conf.py renamed to docs/conf.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
'nbsphinx',
3232
'jupyter_sphinx',
3333
'nbsphinx_link',
34+
'jupyterlite_sphinx',
3435
]
3536

3637
# Set the nbsphinx JS path to empty to avoid showing twice of the widgets
@@ -72,7 +73,7 @@
7273
# get version from python package:
7374
import os
7475
here = os.path.dirname(__file__)
75-
repo = os.path.join(here, '..', '..')
76+
repo = os.path.join(here, '..')
7677
_version_py = os.path.join(repo, 'ipyopenlayers', '_version.py')
7778
version_ns = {}
7879
with open(_version_py) as f:
@@ -114,7 +115,7 @@
114115
# Add any paths that contain custom static files (such as style sheets) here,
115116
# relative to this directory. They are copied after the builtin static files,
116117
# so a file named "default.css" will overwrite the builtin "default.css".
117-
html_static_path = ['_static']
118+
html_static_path = []
118119

119120

120121
# -- Options for HTMLHelp output ------------------------------------------
@@ -181,18 +182,13 @@
181182

182183

183184
# Example configuration for intersphinx: refer to the Python standard library.
184-
intersphinx_mapping = {'https://docs.python.org/': None}
185+
intersphinx_mapping = {'python': ('https://docs.python.org/3/', None)}
185186

186187
# Read The Docs
187188
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from
188189
# docs.readthedocs.org
189190
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
190191

191-
if not on_rtd: # only import and set the theme if we're building docs locally
192-
import sphinx_rtd_theme
193-
html_theme = 'sphinx_rtd_theme'
194-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
195-
196192
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
197193

198194

@@ -211,3 +207,11 @@ def add_scripts(app):
211207
logger.warning('missing javascript file: %s' % fname)
212208
app.add_js_file(fname)
213209
app.connect('builder-inited', add_scripts)
210+
211+
jupyterlite_dir = "."
212+
jupyterlite_contents = "../examples/"
213+
jupyterlite_silence = False
214+
jupyterlite_bind_ipynb_suffix = False
215+
216+
html_theme = "pydata_sphinx_theme"
217+
htmlhelp_basename = "ipyopenlayersdoc"

Diff for: docs/controls/fullscreen_control.rst

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Fullscreen Control
2+
==================
3+
4+
5+
The Fullscreen Control in `ipyopenlayers` allows users to toggle the map view between fullscreen and windowed modes. This control enhances the user experience by providing an easy way to expand the map to occupy the entire screen.
6+
7+
8+
Example
9+
-------
10+
11+
12+
.. jupyter-execute::
13+
14+
15+
from ipyopenlayers import Map, FullScreen, RasterTileLayer
16+
17+
18+
# Create a map with initial zoom level and center coordinates
19+
m = Map(center=[0, 0], zoom=2)
20+
21+
# Add layer
22+
layer=RasterTileLayer()
23+
m.add_layer(layer)
24+
25+
# Add a FullscreenControl to the map
26+
fullscreen_control = FullScreen()
27+
m.add_control(fullscreen_control)
28+
29+
30+
# Display the map
31+
m
32+
33+
34+
35+
36+
Attributes
37+
----------
38+
39+
40+
.. autoclass:: ipyopenlayers.openlayers.FullScreen
41+
:members:
42+
43+

Diff for: docs/controls/index.rst

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Controls
2+
===================
3+
Controls provide interactive elements on a map that allow users to manipulate the map view or access additional functionalities. These controls can include zoom buttons, layer switches, and other user interface elements that enhance the usability and functionality of the map.
4+
5+
.. toctree::
6+
:maxdepth: 1
7+
8+
zoomslider_control
9+
scaleline_control
10+
fullscreen_control
11+
mouseposition_control

Diff for: docs/controls/mouseposition_control.rst

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Mouse Position Control
2+
======================
3+
4+
5+
The Mouse Position Control in `ipyopenlayers` shows the geographical coordinates of the mouse pointer on the map. This control is useful for users who need to know the precise location of their cursor within the map view.
6+
7+
8+
Example
9+
-------
10+
11+
12+
.. jupyter-execute::
13+
14+
15+
from ipyopenlayers import Map, MousePosition, RasterTileLayer
16+
17+
18+
# Create a map with initial zoom level and center coordinates
19+
m = Map(center=[0, 0], zoom=2)
20+
21+
# Add layer
22+
layer=RasterTileLayer()
23+
m.add_layer(layer)
24+
25+
26+
# Add a MousePositionControl to the map
27+
mouseposition_control = MousePosition()
28+
m.add_control(mouseposition_control)
29+
30+
31+
# Display the map
32+
m
33+
34+
35+
36+
37+
Attributes
38+
----------
39+
40+
41+
.. autoclass:: ipyopenlayers.openlayers.MousePosition
42+
:members:

Diff for: docs/controls/scaleline_control.rst

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Scaleline Control
2+
=================
3+
4+
5+
The Scaleline Control in `ipyopenlayers` displays a scale line on the map, providing users with a visual reference for the map's scale. This helps users to understand the distances represented on the map at the current zoom level.
6+
7+
8+
Example
9+
-------
10+
11+
12+
.. jupyter-execute::
13+
14+
15+
from ipyopenlayers import Map, ScaleLine, RasterTileLayer
16+
17+
18+
# Create a map with initial zoom level and center coordinates
19+
m = Map(center=[0, 0], zoom=2)
20+
21+
# Add layer
22+
layer=RasterTileLayer()
23+
m.add_layer(layer)
24+
25+
26+
# Add a ScalelineControl to the map
27+
scaleline_control = ScaleLine()
28+
m.add_control(scaleline_control)
29+
30+
31+
# Display the map
32+
m
33+
34+
35+
36+
37+
Attributes
38+
----------
39+
40+
41+
.. autoclass:: ipyopenlayers.openlayers.ScaleLine
42+
:members:

Diff for: docs/controls/zoomslider_control.rst

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Zoom Slider Control
2+
===================
3+
4+
5+
The Zoom Slider Control in `ipyopenlayers` provides a convenient slider interface for users to control the zoom level of the map.
6+
This control enhances the user experience by allowing a more intuitive and precise adjustment of the zoom level.
7+
8+
9+
Example
10+
-------
11+
12+
13+
.. jupyter-execute::
14+
15+
16+
from ipyopenlayers import Map, ZoomSlider, RasterTileLayer
17+
18+
19+
# Create a map with initial zoom level and center coordinates
20+
m = Map(center=[0, 0], zoom=2)
21+
22+
# Add layer
23+
layer=RasterTileLayer()
24+
m.add_layer(layer)
25+
26+
27+
# Add a ZoomSlider control to the map
28+
zoom_slider = ZoomSlider()
29+
m.add_control(zoom_slider)
30+
31+
32+
# Display the map
33+
m
34+
35+
36+
37+
38+
Attributes
39+
----------
40+
41+
42+
.. autoclass:: ipyopenlayers.openlayers.ZoomSlider
43+
:members:
File renamed without changes.

Diff for: docs/environment.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: ipyopenlayers_docs
1+
name: xeus-python-kernel
22
channels:
3+
- https://repo.mamba.pm/emscripten-forge
34
- conda-forge
45
dependencies:
5-
- python=3.*
6-
- nodejs
7-
- jupyter_sphinx
8-
- sphinx
9-
- sphinx_rtd_theme
10-
- nbsphinx
11-
- nbsphinx-link
6+
- python=3.11
7+
- xeus-python
8+
- ipywidgets
9+
- traitlets
10+
- pip:
11+
- ..

Diff for: docs/europe_110.geo.json

+1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)