Python2 and pygtk migration to Python3 and pygobject
Abstract:
- Since January 2020, python2 has reached its end of life initially planned for 2015.
- pygtk will never support python3 and will be removed from Debian Bullseye (current testing in June 2020).
- cadbiom GUI will first need to be ported away from pygtk (which was already a bad choice in 2012...).
- After that, all packages can be ported from python2 to python3.
- Yes, all this mess could have been avoided by a careful choice of technologies to be used at the start of the project...
Migration to do: the mistletoe first the transition to python3 then. This order did not come out of nowhere, it is in this sense that a migration from pygtk must be done because pybobject is compatible with python2. This avoids having to migrate pygtk => pygobject at the same time as the python2 => python3 migration.
See an example among many others: https://lists.debian.org/debian-gtk-gnome/2019/10/msg00001.html
Non-GUI packages could however be "quickly" converted to python3. From experience the risk generated by their conversion to priority will be to leave the GUI behind, which will deprive us of a visual debugging tool crucial for the project. In addition, the GUI is considered dispensable by non-users, its GTK + Python3 migration will necessarily be left out after the achievement of the short-term objective of just updating other packages for the publication (...).
Step 1 - Upgrade of glade files
Glade2 files must be updated and functional in test windows not implementing any management code. This will then allow us to freely update the user interaction management code.
List of files using glade interfaces:
Progression | Source + lines of references | Glade |
---|---|---|
[ ] | ./chart_checker/chart_checker_controler.py:146 | chart_glade/occurence_form.glade |
[ ] | ./chart_checker/chart_checker_controler.py:515 | chart_glade/checker_solutions.glade |
[ ] | ./chart_checker/chart_checker_controler.py:649 | chart_glade/button_frame.glade |
[ ] | ./charter_info.py:237 | chart_glade/model_info.glade |
[ ] | ./charter_info.py:285 | chart_glade/node_info.glade |
[ ] | ./charter_info.py:330 | chart_glade/trans_info.glade |
[ ] | ./charter.py:134 | chart_glade/charter.glade |
[ ] | ./chart_misc_widgets.py:440 | chart_glade/import_parameter.glade |
[ ] | ./chart_misc_widgets.py:604 | chart_glade/import_BioPAX_parameters.glade |
[ ] | ./chart_simulator/chart_simul_controler.py:101 | chart_glade/chart_simulator.glade |
[ ] | ./chart_simulator/chart_simul_controler.py:488 | chart_glade/simu_places.glade |
[ ] | ./chart_static/chart_stat_controler.py:65 | chart_glade/static_analysis.glade |
[ ] | ./chart_static/chart_stat_controler.py:202 | chart_glade/dependency_graph.glade |
[ ] | ./chart_static/chart_stat_controler.py:376 | chart_glade/checker_solutions.glade |
[ ] | ./chart_static/chart_stat_controler.py:493 | chart_glade/button_frame.glade |
[ ] | ./chart_static/chart_stat_controler.py:674 | chart_glade/button_frame.glade |
[ ] | ./chart_static/chart_stat_controler.py:808 | chart_glade/button_frame.glade |
[ ] | ./utils/text_page.py:198 | chart_glade/biosiged.glade |
Step 2 - Upgrade of the user interaction management code
True pygtk to pygobject migration, replacement of all references to GTK2 and removal of obsolete dependencies (gtksourceview2 for example).
List of files specifically importing gtk2 elements:
Progression | Source |
---|---|
./chart_checker/chart_checker_controler.py | |
./chart_controler.py | |
./charter_info.py | |
./charter.py | |
./chart_misc_widgets.py | |
./chart_simulator/chart_chrono.py | |
./chart_simulator/chart_simul_controler.py | |
./chart_static/chart_stat_controler.py | |
./chart_view.py | |
./graphics/drawing_style.py | |
./utils/fileHandling.py | |
./utils/gtkcodebuffer.py | |
./utils/listDisplay.py | |
./utils/notebookUtils.py | |
./utils/text_page.py | |
./utils/warn.py |
Step 3 - Upgrade from python2 to python3
The entirety of the code will have to be modified in a conversion operation before obtaining a functional project since the goal is not to make python2-python3 compatible code but just python3 code.
Order of operations which will be detailed later when the time comes:
-
Migration of the library -
Run tests on the library -
Migration of the GUI (which rely on the library) -
Migration of the command line -
Run tests on the command line -
Migration of the BioPAX2cadbiom project