Overview
Integrating a Jupyter-style interactive page directly into the GRASS GIS desktop application could significantly elevate the scripting, visualization, and documentation workflows for GRASS GIS users. By directly embedding the grass.jupyter library (thanks to the work of @chaedri ), this feature would allow users to run GRASS GIS commands interactively within the desktop environment, view real-time outputs, write Markdown-based notes and documentation, and export the interactive session to various formats, including Markdown, HTML, and potentially LaTeX. Ideally, this could be added as a new middle notebook page type, complementing existing options like map displays and the graphical modeler.
Related Issue: This builds on Issue #4237, which proposed a simpler “Notes” panel for static metadata and text. The Jupyter-style interactive page could serve a broader purpose, while the “Notes” panel might be suitable for lightweight, non-executable metadata and project notes.
Describe the solution you'd like - Basic Functionality of the Jupyter-Style Interactive Page
1. Automatic Jupyter Environment Initialization: Upon creating a new interactive page, initialize the Jupyter environment session with init() from grass.jupyter.
2. Look of Code cells:
Input Area: Each code cell would include a wx.TextCtrl for basic code input, or potentially a wx.stc.StyledTextCtrl for syntax highlighting.
Execution: A “Run” button triggers cell execution, sending code to the Jupyter kernel via grass.jupyter.
Output Display: After execution, results return to a wx.TextCtrl or other appropriate output widget. It should support interactive outputs: as interactive maps and images, leveraging wx.html2.WebView, wx.Image, or wx.StaticBitmap widgets.
Status Indicators: Display icons for different cell states (e.g., “not run,” “running,” “completed,” “error”) using symbols similar to those in the History panel (checkmark, dot, cross, question mark).
Drop-down menu: options to delete, copy, and clear output.
3. Look of Markdown cells:
Use wx.html2.WebView to display Markdown converted to HTML.
Similar to Jupyter Notebooks, Markdown content would update upon execution.
Drop-down menu with options to delete, copy.
4. File Operations:
Save as Markdown: Save the entire page to a Markdown file.
Load from Markdown: Load an existing Markdown document into the Jupyter interactive page, preserving cell types and content.
5. Run and management options
Interrupting the kernel and restarting the session
Execute all cells
Empty outputs
Enable to select some cell
Advanced Functionality of the Jupyter-Style Interactive Page
Save as HTML: Export the page to HTML, including Markdown and cell outputs
LaTeX export option
Background color to selected cells: maybe also different colors for code and markdown cells
Execute only code cells, or specific ranges: e.g. all cells above/below the selected cell as currently possible in Jupyter Notebook environment).
... Do not be afraid to edit and add possible other useful functionalities here :-)
Other things to think about
Project Integration: Since grass.jupyter supports mapset switching, the Jupyter interactive page could probably be associated with projects. When changing locations, users might be prompted to save their work in Markdown.
Cross-GUI Integration: Should code cells be able to affect elements outside the Jupyter page, like updating an external map display window?
... Add your suggestions here :-)
Inspiration
RStudio’s R Markdown setup offers a helpful model for combining code and Markdown in an interactive format. The attached screenshots show how working with R Markdown looks like in Desktop application (it is very similar to the proposal in this Issue at least from visualization and conceptual aspect):
Overview Integrating a Jupyter-style interactive page directly into the GRASS GIS desktop application could significantly elevate the scripting, visualization, and documentation workflows for GRASS GIS users. By directly embedding the grass.jupyter library (thanks to the work of @chaedri ), this feature would allow users to run GRASS GIS commands interactively within the desktop environment, view real-time outputs, write Markdown-based notes and documentation, and export the interactive session to various formats, including Markdown, HTML, and potentially LaTeX. Ideally, this could be added as a new middle notebook page type, complementing existing options like map displays and the graphical modeler.
Related Issue: This builds on Issue #4237, which proposed a simpler “Notes” panel for static metadata and text. The Jupyter-style interactive page could serve a broader purpose, while the “Notes” panel might be suitable for lightweight, non-executable metadata and project notes.
Describe the solution you'd like - Basic Functionality of the Jupyter-Style Interactive Page
1. Automatic Jupyter Environment Initialization: Upon creating a new interactive page, initialize the Jupyter environment session with init() from grass.jupyter.
2. Look of Code cells:
3. Look of Markdown cells:
4. File Operations:
5. Run and management options
Advanced Functionality of the Jupyter-Style Interactive Page
Save as HTML: Export the page to HTML, including Markdown and cell outputs
LaTeX export option
Background color to selected cells: maybe also different colors for code and markdown cells
Execute only code cells, or specific ranges: e.g. all cells above/below the selected cell as currently possible in Jupyter Notebook environment).
... Do not be afraid to edit and add possible other useful functionalities here :-)
Other things to think about
Project Integration: Since grass.jupyter supports mapset switching, the Jupyter interactive page could probably be associated with projects. When changing locations, users might be prompted to save their work in Markdown.
Cross-GUI Integration: Should code cells be able to affect elements outside the Jupyter page, like updating an external map display window?
... Add your suggestions here :-)
Inspiration RStudio’s R Markdown setup offers a helpful model for combining code and Markdown in an interactive format. The attached screenshots show how working with R Markdown looks like in Desktop application (it is very similar to the proposal in this Issue at least from visualization and conceptual aspect):
R Markdown project:
Visualization inside the project:
Possibility for knitting markdown to HTML page:
HTML page: