Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
b3116a2
basic functionality
May 21, 2025
abf8ac8
not working version - but already refactored hugely
May 23, 2025
706edef
fully working version after refactoring
May 27, 2025
215c9ee
applying relevant github-advanced-security suggestions
Jun 17, 2025
f998d79
handling better when jupyter is not installed or is launched on Windo…
Oct 1, 2025
ecdf907
add info about working dir to status msg
Oct 17, 2025
1aa15db
new start dialog for working dir and template settings
Oct 20, 2025
3c4e33c
refactoring and other refinement edits
Oct 21, 2025
e07f03c
hide Jupyter UI elements
Nov 3, 2025
1f31eb2
Fix making template_notebooks/ sub diretory
tmszi Nov 16, 2025
d62606e
adding the check for wx.html2 presence and making Jupyter button inac…
Jan 2, 2026
146dfa5
incorporating notes from Tomas in stop_server method
Jan 2, 2026
7bf116f
Update python/grass/workflows/__init__.py
echoix Jan 2, 2026
0691a27
fixes from Tomas Z.
Jan 4, 2026
dcf1b8e
edit in except handling
Jan 5, 2026
a24456d
Update python/grass/workflows/template_notebooks/welcome.ipynb
lindakarlovska Feb 5, 2026
0d84812
Update python/grass/workflows/template_notebooks/welcome.ipynb
lindakarlovska Feb 5, 2026
15ffbf7
Update python/grass/workflows/template_notebooks/new.ipynb
lindakarlovska Feb 5, 2026
287a427
Update python/grass/workflows/template_notebooks/welcome.ipynb
lindakarlovska Feb 5, 2026
f75ef87
Update python/grass/workflows/server.py
lindakarlovska Feb 5, 2026
fdd4cea
Update python/grass/workflows/template_notebooks/welcome.ipynb
lindakarlovska Feb 5, 2026
e586078
Update python/grass/workflows/directory.py
lindakarlovska Feb 5, 2026
7ea43b6
works also for multi-window GUI
Feb 5, 2026
12b54f0
changes in icons order in toolbar, button for Jupyter start always ac…
Feb 5, 2026
55b5f52
add Jupyter Notebook to file menu and change the order of items to ha…
Feb 6, 2026
06131f5
fix in the parameter calling
Feb 6, 2026
509453e
applying suggestions from Claude regarding mainly zombie processes an…
Feb 6, 2026
3ee6ae4
shutil used to find in jupyter is in PATH - needs to be tested also o…
Feb 6, 2026
b2d15f7
Anna's and Vashek suggestions + adding Open in browser button
Feb 8, 2026
b0008db
multi-window works again as well as requirement checks (jupyter noteb…
Feb 10, 2026
0bee46f
code completely moved from python/grass/workflows to wxpython/jupyter…
Feb 10, 2026
aff0cca
fix formatting and add jupyter_notebook also to CMakeLists
Feb 12, 2026
4502a50
let the order as it was
Feb 12, 2026
9276616
fix in new.ipynb file and refactoring of create_new_notebook and crea…
Feb 13, 2026
1ad736b
renames: NOTEBOOK_MAPSET to MAPSET_PATH, NOTEBOOK_DIR to WORKING_DIR
Feb 13, 2026
e42f294
2025 -> 2026 and some small edits in file headers
Feb 13, 2026
1191283
docstring edit
Feb 13, 2026
40f3328
more specific exceptions and some other small refinements
Feb 14, 2026
d9d15e0
better exception desc in start_server method
Feb 14, 2026
2db820d
moving get_default_jupyter_workdir to the utils.py
Feb 16, 2026
d03572e
all server instances are registered, regarding the structure - go bac…
Feb 16, 2026
22f0869
better error handling and new lightweight panel for Jupyter running i…
Feb 16, 2026
bdd13e5
fix jupyter notebook modes in multi-window GUI
Feb 17, 2026
8a955dc
change the order of working directory pickers in startup dialog
Feb 17, 2026
60d206c
notebook names as variables
Feb 20, 2026
4b98186
add type annotations to directory.py and edit docstrings
Feb 20, 2026
aae3cea
better desc in startup dialog, directory -> storage, changing default…
Feb 20, 2026
8a7a560
get rid of the word default and replace it by the word project
Feb 20, 2026
2cff2e6
workdir -> storage
Feb 20, 2026
8778b3b
directory.py -> storage.py
Feb 20, 2026
d7ae463
type notations and smaller refactoring, creating some global variables
Feb 22, 2026
cf53855
get rid of rsplit in toolbars.py
Feb 22, 2026
672fe20
making templates more user friendly + adding Tools API examples
Feb 22, 2026
4acb6f5
Error is empty - delete it
Feb 23, 2026
193d6fb
fixed . directory, unified panel and frame naming + refactoring
Feb 24, 2026
896841b
Update gui/wxpython/jupyter_notebook/template_notebooks/welcome.ipynb
lindakarlovska Feb 24, 2026
5741286
Update gui/wxpython/jupyter_notebook/template_notebooks/welcome.ipynb
lindakarlovska Feb 24, 2026
00b26a2
better wording in welcome.ipynb
Feb 24, 2026
cf8dc16
small refinements in welcome.ipynb based on reviews
Feb 24, 2026
a870195
Fix hyperlinks not working in integrated Jupyter WebView + always ope…
Feb 24, 2026
5ca492b
JupyterBrowserPanel - open directly welcome notebook (welcome.ipynb) …
Feb 28, 2026
c135597
fix panel tooltip to persist after undock/dock
Feb 28, 2026
68b1ca2
add minimal toolbar to JupyterBrowserPanel
Feb 28, 2026
f1f4128
documentation for Using Jupyter Notebooks from GRASS GUI
Mar 3, 2026
1f2bba5
Update gui/wxpython/jupyter_notebook/template_notebooks/welcome.ipynb
lindakarlovska Mar 16, 2026
7e6014b
Update gui/wxpython/jupyter_notebook/template_notebooks/welcome.ipynb
lindakarlovska Mar 16, 2026
06efbc1
Update gui/wxpython/jupyter_notebook/template_notebooks/welcome.ipynb
lindakarlovska Mar 16, 2026
59558f7
Update gui/wxpython/jupyter_notebook/template_notebooks/welcome.ipynb
lindakarlovska Mar 16, 2026
45d4ff5
Update gui/wxpython/jupyter_notebook/template_notebooks/welcome.ipynb
lindakarlovska Mar 16, 2026
9100576
Update doc/jupyter_intro.md
lindakarlovska Mar 16, 2026
a16c128
Update doc/jupyter_intro.md
lindakarlovska Mar 16, 2026
da8d07c
Update doc/jupyter_intro.md
lindakarlovska Mar 16, 2026
8f5f2a1
jupyter GUI docs moved to the GUI section + new Ways to Use Jupyter …
Mar 16, 2026
590df4f
better jupyter_intro docs
Mar 17, 2026
ff48065
Anna's suggestion - bullets with links to tutorials
Mar 20, 2026
fe37d76
fix in welcome.ipynb from testing
Mar 20, 2026
245440e
make hiding an interface switcher more general
Mar 23, 2026
b4a6611
check for MS Edge WebView2 runtime on Windows
Apr 8, 2026
1072460
return always the notebook running under GRASS environment - GRASS_PY…
Apr 10, 2026
87bde76
small refactoring and extending WebView2 catch to multi-window GUI
Apr 12, 2026
d319e0b
Vasheks doc rewrite - better way of communicating what the Jupyter NB…
Apr 12, 2026
5b2fa8c
keep only sys.executable as executable, get rid of os import in serve…
Apr 15, 2026
87534c3
dialog for easy notebook installation, dialog for easy wxpython reins…
Apr 16, 2026
c5ddd10
small edit in start_server command + desc extension
Apr 19, 2026
66abadf
extending GUI docs - adding Windows Setup section and Command Used to…
Apr 19, 2026
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
14 changes: 10 additions & 4 deletions doc/jupyter_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,13 @@ library documentation page.

## Tutorials

- [Get started with GRASS in Jupyter Notebooks on Windows](https://grass-tutorials.osgeo.org/content/tutorials/get_started/JupyterOnWindows_OSGeo4W_Tutorial.html)
- [Get started with GRASS & Python in Jupyter Notebooks (Unix/Linux)](https://grass-tutorials.osgeo.org/content/tutorials/get_started/fast_track_grass_and_python.html)
- [Get started with GRASS in Google Colab](https://grass-tutorials.osgeo.org/content/tutorials/get_started/grass_gis_in_google_colab.html)
- Run `grass.jupyter` tutorial on Binder: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/OSGeo/grass/main?labpath=doc%2Fexamples%2Fnotebooks%2Fjupyter_tutorial.ipynb)
For local installation, see the tutorials for [Unix/Linux]
(<https://grass-tutorials.osgeo.org/content/tutorials/get_started/fast_track_grass_and_python.html>)
or [Windows](https://grass-tutorials.osgeo.org/content/tutorials/get_started/JupyterOnWindows_OSGeo4W_Tutorial.html).
If you want to combine the notebook workflow with the desktop GUI experience,
the GUI includes a built-in [Jupyter integration](wxGUI.jupyter.md) (since v8.5+).
For cloud setup, see the [Google Colab tutorial](https://grass-tutorials.osgeo.org/content/tutorials/get_started/grass_gis_in_google_colab.html).

To try GRASS in a notebook without any setup,
run the `grass.jupyter` tutorial on Binder:
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/OSGeo/grass/main?labpath=doc%2Fexamples%2Fnotebooks%2Fjupyter_tutorial.ipynb)
Binary file added gui/icons/grass/jupyter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions gui/icons/grass/jupyter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions gui/wxpython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(gui_lib_DIRS
lmgr
location_wizard
main_window
jupyter_notebook
mapdisp
mapwin
modules
Expand Down
7 changes: 4 additions & 3 deletions gui/wxpython/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@ include $(MODULE_TOPDIR)/include/Make/Python.make
DSTDIR = $(GUIDIR)/wxpython

SRCFILES := $(wildcard icons/*.py xml/*) \
$(wildcard animation/*.py core/*.py datacatalog/*.py history/*.py dbmgr/*.py gcp/*.py gmodeler/*.py \
$(wildcard animation/*.py core/*.py datacatalog/*.py jupyter_notebook/*.py history/*.py dbmgr/*.py gcp/*.py gmodeler/*.py \
gui_core/*.py iclass/*.py lmgr/*.py location_wizard/*.py main_window/*.py mapwin/*.py mapdisp/*.py \
mapswipe/*.py modules/*.py nviz/*.py psmap/*.py rdigit/*.py \
rlisetup/*.py startup/*.py timeline/*.py vdigit/*.py \
vnet/*.py web_services/*.py wxplot/*.py iscatt/*.py tplot/*.py photo2image/*.py image2target/*.py) \
$(wildcard jupyter_notebook/template_notebooks/*.ipynb) \
wxgui.py README.md

DSTFILES := $(patsubst %,$(DSTDIR)/%,$(SRCFILES)) \
$(patsubst %.py,$(DSTDIR)/%.pyc,$(filter %.py,$(SRCFILES)))

PYDSTDIRS := $(patsubst %,$(DSTDIR)/%,animation core datacatalog history dbmgr gcp gmodeler \
PYDSTDIRS := $(patsubst %,$(DSTDIR)/%,animation core datacatalog jupyter_notebook history dbmgr gcp gmodeler \
gui_core iclass lmgr location_wizard main_window mapwin mapdisp modules nviz psmap \
mapswipe vdigit wxplot web_services rdigit rlisetup startup \
vnet timeline iscatt tplot photo2image image2target)


DSTDIRS := $(patsubst %,$(DSTDIR)/%,icons xml)
DSTDIRS := $(patsubst %,$(DSTDIR)/%,icons xml jupyter_notebook/template_notebooks)

default: $(DSTFILES)
ifndef CROSS_COMPILING
Expand Down
Binary file added gui/wxpython/docs/jupyter_browser_mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gui/wxpython/docs/jupyter_integrated_mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gui/wxpython/docs/jupyter_startup_dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
164 changes: 164 additions & 0 deletions gui/wxpython/docs/wxGUI.jupyter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
authors:
- Linda Karlovska
- GRASS Development Team
---

# Using Jupyter Notebooks from GUI

Starting with GRASS 8.5, the GUI provides integrated support for launching
and managing Jupyter Notebooks directly from the interface.
This lets you combine interactive Python notebooks with your GUI workflow.

## Before You Start

- Linux: no additional setup is currently required.
- Windows: setup and dependency fixes are guided automatically by GRASS dialogs.
For details, see [Windows Setup Details](#windows-setup-details).

## Getting Started

To launch Jupyter from GUI, go to **File → Jupyter Notebook** or
click the Jupyter button in the Tools toolbar at the top of the GRASS window.
The startup dialog lets you configure your notebook environment:

![Jupyter Startup Dialog](jupyter_startup_dialog.png)

### Configuration Options

- **Where to Save Notebooks:** Select where your Jupyter notebooks will be stored.
You can choose an existing directory, create a new one, or leave the field empty
to use your current directory. Notebooks can be saved anywhere, including
inside your current GRASS project.

- **Create Welcome Notebook:** Check this option to automatically create
a `welcome.ipynb` template notebook with GRASS-specific examples and
quick-start code. Recommended for new users.

### Display Modes

After configuring the storage, choose how to interact with Jupyter notebooks:

#### Browser Mode

![Browser Mode - Jupyter opened in your default web browser](jupyter_browser_mode.png)

In Browser Mode, Jupyter opens in your default system web browser.

This mode provides:

- Full Jupyter Lab/Notebook interface with all features
- File browser and notebook management
- Terminal access and extensions support
- A control panel in GRASS GUI showing server URL, PID, and storage location
- Quick access to reopen the browser or stop the server

#### Integrated Mode

![Integrated Mode - Jupyter embedded directly in GRASS GUI](jupyter_integrated_mode.png)

In Integrated Mode, Jupyter notebooks are embedded directly in the GRASS GUI window
(if the wx.html2 library is available). This mode offers:

- Jupyter interface embedded as a native GRASS GUI tab
- Seamless integration with other GRASS tools and panels
- Import/export notebooks, and create new notebooks from the toolbar
- External links (documentation, tutorials) open in your system browser

### Toolbar Actions

The Integrated mode toolbar provides quick access to common operations:

- **Create:** Create a new notebook with prepared GRASS module imports and session
initialization
- **Import:** Import existing .ipynb files into your notebook storage
- **Export:** Export the current notebook to a different location
- **Undock:** Open the notebook in a separate window (also available in
the browser mode)
- **Stop:** Stop the Jupyter server and close the notebook (also available in
the browser mode)

### Multiple Notebook Sessions

You can launch multiple Jupyter sessions with different storage locations.
Each session appears as a separate tab in the GRASS GUI, with its storage
location shown in the tab name. Hover over a tab to see the full storage path.

### Server Management

GRASS automatically manages Jupyter server instances:

- Each notebook storage location runs on a separate Jupyter server
- Servers are automatically stopped when GRASS exits
- Multiple notebooks from the same storage share one server instance
- Server information (URL, PID) is displayed in the interface

### Command Used to Start Jupyter

GRASS starts Jupyter with the same command on Windows, Linux, and macOS:

```bash
<GRASS Python> -m notebook ...
```

The main reason for this choice is Windows standalone reliability. On
Windows standalone installations, running `python -m jupyter notebook` can fail
even when Notebook is installed and available. A typical symptom is an
import/bootstrap error (for example `Could not import runpy._run_module_as_main`
or `AssertionError: SRE module mismatch`).

This usually indicates a Python environment mismatch in the `jupyter` launcher
path, where imported modules do not fully match the active GRASS Python runtime.
Using `python -m notebook` avoids that extra launcher layer.

### Tips

- The `welcome.ipynb` template includes GRASS session initialization
and practical examples of listing data, visualizing maps,
and running analyses with the Tools API

- You can switch between browser and integrated modes by closing one and
relaunching Jupyter with the same storage location

- Tab tooltips show the full storage path - useful when working with
multiple storage locations

## Windows Setup Details

This section describes the Windows-specific setup.
Users on Linux and macOS can skip this section.

### Install Missing Notebook Package

If the `notebook` package is missing when you click **Launch Jupyter
Notebook**, GRASS detects this automatically and opens a dialog that offers to
install it. Clicking **Install** runs:

```bash
<GRASS Python> -m pip install notebook
```

in the current GRASS Python environment. After installation, the
Jupyter Startup dialog opens normally.

If the automatic installation fails, an error dialog displays the exact command
you can run manually in the GRASS Python console.

### Microsoft Edge WebView2 Runtime Support for Integrated Mode

Integrated mode requires `wx.html2.WebView` with Microsoft Edge WebView2
backend support. Some wxPython builds (including current OSGeo4W-based
builds) are compiled without WebView2 support, so Integrated mode cannot start.

When you choose Integrated mode and WebView2 is not available, GRASS detects
this and opens a dialog offering to reinstall wxPython using pip. The
reinstall keeps the currently installed wxPython version, but fetches the pip
wheel that includes WebView2 support. Clicking **Reinstall** runs:

```bash
<GRASS Python> -m pip install --force-reinstall wxpython==<current version>
```

Because the current GRASS session still uses the previously loaded wxPython
build, a restart is required after reinstalling. After restart, Integrated mode
should start successfully.
Loading
Loading