Bug 132266 - Interactive-type macros
Summary: Interactive-type macros
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
6.3.5.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-Python
  Show dependency treegraph
 
Reported: 2020-04-20 01:24 UTC by r.a.scarfe
Modified: 2022-06-24 13:47 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description r.a.scarfe 2020-04-20 01:24:18 UTC
Description:
Conda and jupyter are integral parts of Python's ascendancy in data science, and neither are python-specific tools.

I have a proposal in two parts:

* Add a core option for macros in Calc "Tools" -> "Macros" -> "Interactive" -> "Python" that launches the bundled python repl and automatically includes the local variable "document" as web browsers consoles do. When I exit the REPL I should get an option to save my session as a macro.
* Add an extension that adds a jupyter kernel from a conda environment installed outside libreoffice installation. There are graphical tools to manage this such as Continuum Analytics' Anaconda Navigator. There are many jupyter kernels available: https://github.com/jupyter/jupyter/wiki/Jupyter-kernels. I wouldn't expect a first implementation to provide libreoffice bindings for any of these externally managed kernels.

This feature request represents is intended to document the minimum level of support I would need as a dabbler in order to make LibreOffice a first option for exploratory data science instead of opening up a jupyter notebook.

Steps to Reproduce:
Open up "Tools" -> "Macros" -> "Organise Macros" -> "Python..."

Actual Results:
As someone with a deep level of familiarity with the python REPL as a calculator that's easy to jump into I fail to find anywhere to start writing python commands and get confused as to why it seems so hard to start a new macro.

Expected Results:
I can follow my nose and get to a REPL, then save my session as a macro after I'm done.


Reproducible: Always


User Profile Reset: No



Additional Info:
I love LibreOffice but I am yet to use it as part of my daily workflow. Python has no obvious GUI user story for beginners but being bundled with LibreOffice means that it should be celebrated by the python community, whereas instead it's complex and not idiomatic to ask a beginner to write "Hello World!".
Comment 1 Heiko Tietze 2020-09-08 08:46:31 UTC
Not really a question for UX but the macro team. Alain, what do you think?
Comment 2 Alain Romedenne 2020-09-14 11:52:38 UTC
Hi

While I'm not certain I completely understand r.a.'s requirements, let me try to answer some aspects of these statements.

First and foremost, and for what relates to document, note the following links detail how to script Python macros in LibreOffice:
- https://help.libreoffice.org/latest/en-US/text/sbasic/python/main0000.html
- https://wiki.documentfoundation.org/Macros/Python_Design_Guide

* as for your first comment, please note that you can customize LibreOffice menus in order to start LibO Python interactive console, incorporating LibO bindings in the process. Thus, saving your session is only a matter of copying/pasting the command history.

* I imagine that Conda/Jupyter can be configured in such a way that libO Python shell can be chosen as a preferred Python runtime. Such a facility exists in Geany, PyCharm , Pyzo and are described in the above wiki link. However Python native shell and LibO interactive console do not extend the exact same way. So be prepared for experiments and adaptation efforts.    

I hope I clarified some points, and would gladly to read elaborated descriptions of r.a's current achievements using Conda/Jupyter, Anaconda Navigator or anything alike.

You should have a glance at APSO extension which provides a remarkable assistance when scripting Python macros:
- https://extensions.libreoffice.org/en/extensions/show/apso-alternative-script-organizer-for-python