Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial Review for Tethys 4.3 #1074

Merged
merged 28 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d81a16d
Resolve docs build warnings and errors
swainn Jun 20, 2024
8c6dc0f
Remove tethys db tip from new app project tutorials
swainn Jun 20, 2024
f6c52f9
Add trailing slash to the end of /apps URLs in tutorials
swainn Jun 20, 2024
71a9e40
Fix flake issues with scaffold
swainn Jun 28, 2024
414cd27
Key concepts tutorial fixes
swainn Jun 28, 2024
13d7d9e
Fix height 100% issue for app content (e.g. fullscreen map)
swainn Jul 23, 2024
644bf36
beginner concepts updates
swainn Jul 23, 2024
bb59741
Updates to intermediate tutorial
swainn Jul 23, 2024
fb3ed84
Fix the broken heading links
swainn Jul 23, 2024
562a011
Updates to the advanced tutorial
swainn Jul 25, 2024
c684a1c
Fix scroll issue on map layout
swainn Jul 26, 2024
6192daf
Update beginner tutorial to use the MapLayout.
swainn Jul 26, 2024
ec613a0
Update intermediate tutorial with MapLayout
swainn Jul 26, 2024
a3775a5
Update advanced tutorial to use MapLayout
swainn Jul 26, 2024
fec7583
updates in geoserver and map layout tutorials
jmjohnson1578 Jul 12, 2024
4fe3926
initial documentation updates
jmjohnson1578 Jul 19, 2024
a6465e0
Pass on only the "settings already configured" RuntimeError in docs/c…
swainn Jul 30, 2024
0e1d3d4
Add screenshots to key concepts tutorial, shorten topics lists
swainn Jul 30, 2024
7dc3425
Update the persistent store service screenshot
swainn Jul 30, 2024
dbc03b6
added git lfs instructions
jakeymac Jul 30, 2024
34cb008
fixes in key concepts tutorials, updated 'last updated' dates in othe…
jakeymac Jul 30, 2024
9eb306c
updated tutorials(text + code, dates), added updated screenshots
jakeymac Aug 16, 2024
fb83fe5
missing url parameter added
jakeymac Aug 16, 2024
f03907e
Made changes suggested in pull request #1074, converetd doc files to LF
jakeymac Aug 20, 2024
773e60c
updated tethys logos in docs
jakeymac Aug 21, 2024
653b3b2
fixes for tethys logo in docs
jakeymac Aug 23, 2024
d5ed0fe
linting
jakeymac Aug 23, 2024
d1757b9
removed unused lines in css file
jakeymac Aug 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ cd docs
conda env create -f docs_environment.yml
```

## Initialize git lfs

Use Git LFS to download the images:

```
git lfs install
git lfs pull
```

## Build Docs

Activate the conda environment and build the documentation using these commands:
Expand Down
27 changes: 14 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from django.conf import settings
from setuptools_scm import get_version
from sphinxawesome_theme import ThemeOptions, LinkIcon
from sphinxawesome_theme.postprocess import Icons

# Mock Dependencies
# NOTE: No obvious way to automatically anticipate all the sub modules without
Expand Down Expand Up @@ -123,12 +124,18 @@ def __getattr__(cls, name):
"tethys_layouts",
]

settings.configure(
INSTALLED_APPS=installed_apps,
DEBUG=True,
SECRET_KEY="QNT5VImbg7PktTYfyXZWGwfKqOe1G3CanQWfG0zsE5HZxwHdQs",
)
django.setup()
try:
settings.configure(
INSTALLED_APPS=installed_apps,
DEBUG=True,
SECRET_KEY="QNT5VImbg7PktTYfyXZWGwfKqOe1G3CanQWfG0zsE5HZxwHdQs",
)
django.setup()
except RuntimeError as e:
# Ignore error if settings are already configured
# This can occur when using sphinx-autobuild
if "settings already configured" in str(e).lower():
pass

# Sphinx extensions
extensions = [
Expand Down Expand Up @@ -292,10 +299,4 @@ def __getattr__(cls, name):
html_collapsible_definitions = True

# Link icon for header links instead of pharagraph icons that are the default
html_permalinks_icon = (
'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">'
'<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 '
"5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 "
'0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z">'
"</path></svg>"
)
html_permalinks_icon = Icons.permalinks_icon
4 changes: 2 additions & 2 deletions docs/images/tutorial/advanced/Persistent_Store_Service.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/dask/blank_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/dask/blank_jobs_table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/dask/home_with_delayed_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/dask/home_with_distributed_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/dask/home_with_multiple_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/dask/jobs_table_with_delayed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/dask/jobs_table_with_distributed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/dask/jobs_table_with_multiple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/about_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/clip_by_asset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/dataset_controls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/dataset_controls_js.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/deploy_app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/file_upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/gee_intro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/home_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/map_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/plot_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/rest_api.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/scaffolded_app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/images/tutorial/gee/visualize_gee_layers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ The app workspaces directory is one location where all app workspaces are collec
3. Collect the app workspaces to the ``TETHYS_WORKSPACES_ROOT`` location:

.. code-block::

tethys manage collectworkspaces

.. tip::

You can collect both the static files and the app workspaces with a single command:

.. code-block::
tethys manage collectall

tethys manage collectall
2 changes: 2 additions & 0 deletions docs/tethys_sdk/workspaces.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ In the rare cases where you need to use a workspace where it is not convenient o
.. _workspace_get_app_workspace_func:

.. automethod:: tethys_apps.base.paths.get_app_workspace
:no-index:

.. _workspace_get_user_workspace_func:

.. automethod:: tethys_apps.base.paths.get_user_workspace
:no-index:


Working with Workspaces
Expand Down
18 changes: 9 additions & 9 deletions docs/tutorials/bokeh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Bokeh Integration Concepts
**************************

**Last Updated:** November 2019
**Last Updated:** July 2024

This tutorial introduces ``Bokeh Server`` integration concepts for Tethys developers. Two ``bokeh`` handlers will be created to demonstrate how to link Bokeh plots or widgets to Python functions in the brackground using both a plain Bokeh approach as well as a ``Param`` approach. The topics covered include:

Expand Down Expand Up @@ -33,7 +33,7 @@ To leverage the Bokeh integration with Tethys you will need the ``bokeh`` and ``
.. code-block:: bash

# conda: conda-forge channel strongly recommended for bokeh (the erdc/label/dev channel is currently needed for bokeh-django)
conda install -c conda-forge -c erdc/label/dev bokeh bokeh-django
conda install -c conda-forge -c erdc/label/dev bokeh bokeh-django bokeh_sampledata

# pip
pip install bokeh bokeh-django
Expand All @@ -56,6 +56,7 @@ To leverage the Bokeh integration with Tethys you will need the ``bokeh`` and ``
packages:
- bokeh
- bokeh_django
- bokeh_sampledata

pip:

Expand Down Expand Up @@ -94,7 +95,7 @@ Let's use Bokeh's sea temperature sample data to create a time series plot and l

This simple handler contains the logic for a time series plot of the sea surface temperature sample data provided by ``Bokeh``. The ``handler`` decorator marks this function as a handler. It auto generates a default ``controller function`` that is linked to the handler. A default template can also be used, but we specified a custom template using the ``template`` argument to the ``handler`` decorator. The ``handler`` decorator also sets up the routing. By default the route name and the URL are derived from the ``handler function`` name (in this case ``home``). For more information about the ``handler`` decorator and additional arguments that can be passed see :ref:`handler-decorator`. Since this default controller is sufficient, we don't need to create a custom controller and can just delete the ``controller.py`` file.

2. Delete the ``controller.py`` file.
2. Delete the ``controllers.py`` file.

3. Clear the default ``home.html`` template and add the following code to it.

Expand Down Expand Up @@ -125,7 +126,7 @@ This is a simple Bokeh plot. We will now add the rest of the logic to make it an

...

def home_handler(document):
def home(document):
df = sea_surface_temperature.copy()
source = ColumnDataSource(data=df)

Expand Down Expand Up @@ -185,6 +186,7 @@ In this example we will build on top of the ``bokeh_tutorial`` app to demonstrat
packages:
- bokeh
- bokeh_django
- bokeh_sampledata
- panel
- param

Expand All @@ -202,8 +204,6 @@ In this example we will build on top of the ``bokeh_tutorial`` app to demonstrat
import numpy as np
from bokeh.plotting import figure

...


class Shape(param.Parameterized):
radius = param.Number(default=1, bounds=(0, 1))
Expand Down Expand Up @@ -307,9 +307,9 @@ Note that in this case we are not using a custom template, but we add the ``app_
{% block app_navigation_items %}
{% url tethys_app|url:'home' as home_url %}
{% url tethys_app|url:'shapes' as shapes_url %}
<li class="title">Examples</li>
<li class="{% if request.path == home_url %}active{% endif %}"><a href="{{ home_url }}">Sea Surface</a></li>
<li class="{% if request.path == shapes_url %}active{% endif %}"><a href="{{ shapes_url }}">Shapes</a></li>
<li class="nav-item title">Examples</li>
<li class="nav-item"><a class="nav-link {% if request.path == home_url %}active{% endif %}" href="{{ home_url }}">Sea Surface</a></li>
<li class="nav-item"><a class="nav-link {% if request.path == shapes_url %}active{% endif %}" href="{{ shapes_url }}">Shapes</a></li>
{% endblock %}

If you start tethys and go to the shapes endpoint of this app you should see something like this:
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/dask.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Dask Tutorial
*************

**Last Updated:** May 2022
**Last Updated:** August 2024

This tutorial will walk you through the steps of working with Dask using the Tethys Platform. If you have not already installed Tethys Platform, follow the :doc:`../installation` documentation and then return.

Expand Down
14 changes: 7 additions & 7 deletions docs/tutorials/dask/dask_delayed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Dask Delayed
************

**Last Updated:** May 2022
**Last Updated:** August 2024

The ``DaskJob`` can be used with either the ``dask.delayed`` or ``dask.distributed`` APIs. The next three sections will illustrate how to use each Dask API with TethysJobs. This section will illustrate how to use the ``dask.delayed`` API with ``DaskJob`` in Tethys.

Expand Down Expand Up @@ -45,7 +45,7 @@ Modify the ``home`` controller in the :file:`controller.py` module, adding a but
'data-bs-placement': 'top',
'title': 'Dask Delayed Job'
},
href=reverse('dask_tutorial:run_job', kwargs={'job_type': 'delayed'})
href=App.reverse('run_job', kwargs={'job_type': 'delayed'})
)

jobs_button = Button(
Expand Down Expand Up @@ -77,10 +77,10 @@ Add the ``run_job`` controller to the :file:`controller.py` module as well:
Controller for the app home page.
"""
# Get scheduler from dask_primary setting.
scheduler = app.get_scheduler(name='dask_primary')
scheduler = App.get_scheduler(name='dask_primary')

if job_type.lower() == 'delayed':
from tethysapp.dask_tutorial.job_functions import delayed_job
from .job_functions import delayed_job

# Create dask delayed object
delayed = delayed_job()
Expand All @@ -94,7 +94,7 @@ Add the ``run_job`` controller to the :file:`controller.py` module as well:
# Execute future
dask.execute(delayed)

return HttpResponseRedirect(reverse('dask_tutorial:jobs_table'))
return HttpResponseRedirect(App.reverse('jobs_table'))

.. note::

Expand All @@ -117,13 +117,13 @@ Add the ``app_content`` block to the :file:`home.html` so that it looks like the

If your tethys project does not restart on its own, you may need to do so manually by ending the server with ``ctrl+c``, and then entering the command ``tethys manage start`` again. Now when you navigate to your app page, you should see this:

.. figure:: ../../images/tutorial/NewPostDaskDelayedHome.png
.. figure:: ../../images/tutorial/dask/home_with_delayed_button.png
:width: 900px
:align: center

Click on the ``Dask Delayed Job`` button to launch the new job type. It will submit the job and redirect to the jobs table page:

.. figure:: ../../images/tutorial/NewPostDaskDelayedJobsTable.png
.. figure:: ../../images/tutorial/dask/jobs_table_with_delayed.png
:width: 900px
:align: center

Expand Down
14 changes: 7 additions & 7 deletions docs/tutorials/dask/dask_distributed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Dask Distributed
****************

**Last Updated:** May 2022
**Last Updated:** August 2024

This section will illustrate how to use the ``dask.distributed`` API with ``DaskJob`` in Tethys. This example also illustrates how to use a custom process results function.

Expand Down Expand Up @@ -46,7 +46,7 @@ Modify the ``home`` controller in the :file:`controller.py` module, adding a but
'data-bs-placement': 'top',
'title': 'Dask Delayed Job'
},
href=reverse('dask_tutorial:run_job', kwargs={'job_type': 'delayed'})
href=App.reverse('run_job', kwargs={'job_type': 'delayed'})
)

dask_distributed_button = Button(
Expand All @@ -57,7 +57,7 @@ Modify the ``home`` controller in the :file:`controller.py` module, adding a but
'data-bs-placement': 'top',
'title': 'Dask Future Job'
},
href=reverse('dask_tutorial:run_job', kwargs={'job_type': 'distributed'})
href=App.reverse('run_job', kwargs={'job_type': 'distributed'})
)

jobs_button = Button(
Expand Down Expand Up @@ -114,7 +114,7 @@ Additionally update the ``run_job`` controller in :file:`controller.py` to look
try:
client = scheduler.client
except DaskJobException:
return redirect(reverse('dask_tutorial:error_message'))
return App.redirect(App.reverse('error_message'))

# Create future job instance
future = distributed_job(client)
Expand All @@ -127,7 +127,7 @@ Additionally update the ``run_job`` controller in :file:`controller.py` to look
dask.process_results_function = convert_to_dollar_sign
dask.execute(future)

return HttpResponseRedirect(reverse('dask_tutorial:jobs_table'))
return HttpResponseRedirect(App.reverse('jobs_table'))

3. Setup HTML
=============
Expand All @@ -149,13 +149,13 @@ Modify the ``app_content`` block in the :file:`home.html` so that it looks like

If your tethys project does not restart on its own, you may need to do so manually by ending the server with ``ctrl+c``, and then entering the command ``tethys manage start`` again. Now when you navigate to your app page, you should see this:

.. figure:: ../../images/tutorial/NewPostDaskDistributedHome.png
.. figure:: ../../images/tutorial/dask/home_with_distributed_button.png
:width: 900px
:align: center

Click on the ``Dask Distributed Job`` button to launch the new job type. It will submit the job and redirect to the jobs table page:

.. figure:: ../../images/tutorial/NewPostDaskDistributedJobsTable.png
.. figure:: ../../images/tutorial/dask/jobs_table_with_distributed.png
:width: 900px
:align: center

Expand Down
Loading