Jump to content

GSoC/2024/StatusReports/IsraelGaladima: Difference between revisions

From KDE Community Wiki
Izzygala (talk | contribs)
No edit summary
Izzygala (talk | contribs)
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 8: Line 8:


== Work report ==
== 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 [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
* Fixed an issue which caused the application to crash by increasing the ref count of aspects added to the project from a python script
* Excluded the problematic members in some classes from the binding generation thus removing the need to build shiboken2 and pyside2 from source
'''Week 8'''
* Renamed ScriptEditor to Script, ScriptEditorView to ScriptEditor, Script to ScriptRuntime and PythonScript to PythonScriptRuntime after a code review
* Removed the combobox for changing the language for a Script from the ScriptEditor after a code review


== Links to Blogs and other writing ==
== Links to Blogs and other writing ==
* [https://israelsgalaxy.hashnode.dev/improving-python-interoperability-with-labplot Blog Post #1]
* [https://israelsgalaxy.hashnode.dev/improving-python-interoperability-with-labplot Blog Post #1]
* [https://israelsgalaxy.hashnode.dev/creating-python-bindings-to-labplots-c-backend-part-1 Blog Post #2]
* [https://israelsgalaxy.hashnode.dev/creating-python-bindings-to-labplots-c-backend-part-1 Blog Post #2]
* [https://israelsgalaxy.hashnode.dev/creating-python-bindings-to-labplots-c-backend-part-2 Blog Post #3]
*[https://israelsgalaxy.hashnode.dev/gsoc24-final-blog-post Blog Post #3]

Latest revision as of 17:46, 31 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
  • Fixed an issue which caused the application to crash by increasing the ref count of aspects added to the project from a python script
  • Excluded the problematic members in some classes from the binding generation thus removing the need to build shiboken2 and pyside2 from source

Week 8

  • Renamed ScriptEditor to Script, ScriptEditorView to ScriptEditor, Script to ScriptRuntime and PythonScript to PythonScriptRuntime after a code review
  • Removed the combobox for changing the language for a Script from the ScriptEditor after a code review


Links to Blogs and other writing