GSoC/2024/StatusReports/IsraelGaladima: Difference between revisions

From KDE Community Wiki
< GSoC‎ | 2024‎ | StatusReports
No edit summary
No edit summary
Line 9: Line 9:
== Work report ==
== Work report ==
'''Week 1'''
'''Week 1'''
* Continued reading about shiboken2 and pyside2
* Continued researching about using shiboken2 for python bindings generation
* Set up the cmake build for generating python bindings for a few classes in the backend folder
* Set up the cmake build for generating python bindings for a few classes in the backend folder
* Removed the -DQT_STRICT_ITERATORS compilation flag since it was conflicting with the shiboken2 c++ output
* Removed the -DQT_STRICT_ITERATORS compilation flag since it was conflicting with the shiboken2 c++ output
Line 17: Line 17:
'''Week 3'''
'''Week 3'''
* Fixed an issue in the bindings generation for some classes by building pyside2 and shiboken2 from source
* Fixed an issue in the bindings generation for some classes by building pyside2 and shiboken2 from source
* Created a MR containing minor fixes to the codebase needed for the bindings generation [https://invent.kde.org/education/labplot/-/merge_requests/536 1]
* Created an MR containing minor fixes to the codebase needed for the bindings generation [https://invent.kde.org/education/labplot/-/merge_requests/536]
'''Week 4'''
* Created an MR for the python bindings generation [https://invent.kde.org/education/labplot/-/merge_requests/538]
* Started researching about how to script a C++ application using python. Outlined two approaches: IPC or CPython API
'''Week 5'''
* Implemented the ScriptEditor and ScriptEditorView classes
* Added the "Script Editor" menu option under the "File > Add New" menu and the "Script Editor" button to the Project Toolbar, both for adding a new script editor to the current project
'''Week 6'''
* Implemented the ScriptManager and Script classes
* Implemented the PythonScript class to utilize the CPython API for executing python code from the script editor
* Injected the MainWin object from LabPlot into the Python interpreter to allow python code to modify the running application
'''Week 7'''
* Injected the Project object into the Python interpreter instead of the MainWin object
* Added the bindings as an extension module to the embedded python interpreter
* Fixed an issue which was causing the application to crash by calling Py_Initialize and Py_Finalize only once in the application
* Integrated the ScriptEditorView (KTextEditor) settings into the application settings dialog
* Reworked the application settings dialog to use a tree view instead of a list view, to enable sub pages





Revision as of 18:17, 3 August 2024

Improve Python Interoperability with LabPlot

LabPlot is a data analysis and visualisation application in KDE. Since Python is heavily used within the data science community, this project aims to make LabPlot a more "Python-friendly" application. The project goals are to:

  • Create Python bindings to LabPlot's C++ backend, and
  • Enable Python programs to control a running LabPlot application.

These goals will respectively allow users to:

  • Access LabPlot's data analysis and visualisation tools from a Python program, and
  • Create complex workflows using Python within a running LabPlot application.

Work report

Week 1

  • Continued researching about using shiboken2 for python bindings generation
  • Set up the cmake build for generating python bindings for a few classes in the backend folder
  • Removed the -DQT_STRICT_ITERATORS compilation flag since it was conflicting with the shiboken2 c++ output

Week 2

  • Fixed an issue with circular dependencies in the bindings generation by moving some class members to pimpl classes
  • Generated python bindings for more classes from the backend folder

Week 3

  • Fixed an issue in the bindings generation for some classes by building pyside2 and shiboken2 from source
  • Created an MR containing minor fixes to the codebase needed for the bindings generation [1]

Week 4

  • Created an MR for the python bindings generation [2]
  • Started researching about how to script a C++ application using python. Outlined two approaches: IPC or CPython API

Week 5

  • Implemented the ScriptEditor and ScriptEditorView classes
  • Added the "Script Editor" menu option under the "File > Add New" menu and the "Script Editor" button to the Project Toolbar, both for adding a new script editor to the current project

Week 6

  • Implemented the ScriptManager and Script classes
  • Implemented the PythonScript class to utilize the CPython API for executing python code from the script editor
  • Injected the MainWin object from LabPlot into the Python interpreter to allow python code to modify the running application

Week 7

  • Injected the Project object into the Python interpreter instead of the MainWin object
  • Added the bindings as an extension module to the embedded python interpreter
  • Fixed an issue which was causing the application to crash by calling Py_Initialize and Py_Finalize only once in the application
  • Integrated the ScriptEditorView (KTextEditor) settings into the application settings dialog
  • Reworked the application settings dialog to use a tree view instead of a list view, to enable sub pages


Links to Blogs and other writing