Changes

Jump to navigation Jump to search
4,439 bytes added ,  15:30, 5 November 2013
no edit summary
Line 1: Line 1: −
<noinclude>{{TOCright}}
+
<noinclude>
[[Category:Feature Page Incomplete]]
+
[[Category:FeatureLanded|GTK3]]
[[Category:Feature|GTK3]]
   
</noinclude>
 
</noinclude>
    
== Summary ==
 
== Summary ==
   −
'''Sugar needs to rebase itself on new generations of its key underlying technologies: GTK+ 3 and PyGObject Introspection.''' This page aims to summarise options and community opinions around this challenging shift, and to help formulate a plan of how it will be executed. In other words, it tries to take community input, answer all the unanswered questions, and present a logical path forward that can be adopted by the developers.
+
'''Sugar needs to rebase itself on new generations of its key underlying technologies: GTK+ 3 and PyGObject Introspection.''' Sugar is already somewhat broken on recent distribution versions as a result of this. This page aims to summarise options and community opinions around this challenging shift, and to help formulate a plan of how it will be executed. In other words, it tries to take community input, answer all the unanswered questions, and present a logical path forward that can be adopted by the developers.
    
== Owner ==
 
== Owner ==
* This plan/proposal maintained by [[User:DanielDrake|Daniel Drake]] (other editors welcome!)
+
* This plan/proposal maintained by [[User:DanielDrake|Daniel Drake]] and [[User:Erikos|Simon Schampijer]]
 
* A number of developers will be needed at each stage to successfully execute this; Daniel offers his assistance for a coordination/oversight role if that would be useful.
 
* A number of developers will be needed at each stage to successfully execute this; Daniel offers his assistance for a coordination/oversight role if that would be useful.
    
== Current status ==
 
== Current status ==
* Targeted release: (SUGAR_VERSION)
+
* Targeted release: <b>0.96</b> (the sugar-toolkit and sugar-artwork port)
* Last updated: (DATE)
+
* Last updated: 31.01.12
* Percentage of completion: XX%
+
* Percentage of completion: 35% (the sugar-toolkit and sugar-artwork port will count as 50% when finished)
 +
 
 +
At the Desktop summit, Raul Gutierrez Segales, Benjamin Berg and Paul Proteus successfully [http://www.mail-archive.com/sugar-devel@lists.sugarlabs.org/msg22070.html prototyped] some of the ideas below. After only a few hours of effort, a minimal Sugar GTK3 activity was running alongside GTK2 activities. The plan below should therefore be quite credible, but some prerequisites remain.
    
== Detailed Description ==
 
== Detailed Description ==
Line 47: Line 48:  
# The move to GTK3 allows us to [http://blog.tomeuvizoso.net/2011/05/time-to-port-your-python-application-to.html keep up with our GNOME neighbours], as they improve and refine the base technologies that we share.
 
# The move to GTK3 allows us to [http://blog.tomeuvizoso.net/2011/05/time-to-port-your-python-application-to.html keep up with our GNOME neighbours], as they improve and refine the base technologies that we share.
 
# The move to PyGI is expected to result in [http://blog.tomeuvizoso.net/2009/05/reducing-sugars-memory-usage.html lower memory usage and faster startup].
 
# The move to PyGI is expected to result in [http://blog.tomeuvizoso.net/2009/05/reducing-sugars-memory-usage.html lower memory usage and faster startup].
# Browse has no future under GTK2, it [[Features/WebKit|needs to move to WebKit]] and that move is dependent on Sugar moving to PyGI/GTK3.
+
# Browse has no future under GTK2 and is '''already broken''', it [[Features/WebKit|needs to move to WebKit]] and that move is dependent on Sugar moving to PyGI/GTK3.
# Similarly, Read has a grim future under GTK2 due to static evince bindings no longer being maintained and libevince itself moved to GTK3; we need to switch to PyGI/GTK3 to be able to keep calling into evince and let the Read activity live on.
+
# Similarly, Read is '''already broken''' under GTK2 due to static evince bindings no longer being maintained and libevince itself moved to GTK3; we need to switch to PyGI/GTK3 to be able to keep calling into evince and let the Read activity live on.
    
== Implementation Plan ==
 
== Implementation Plan ==
Line 58: Line 59:  
A prerequisite to porting a Sugar process, component or activity is to remove all its usage of hippocanvas. This library is unmaintained, would be painful to port to GTK3, and can be done better with standard GTK+ code at the Python level. Most users of HippoCanvas can switch to custom GtkContainer widgets.
 
A prerequisite to porting a Sugar process, component or activity is to remove all its usage of hippocanvas. This library is unmaintained, would be painful to port to GTK3, and can be done better with standard GTK+ code at the Python level. Most users of HippoCanvas can switch to custom GtkContainer widgets.
   −
One complication is that hippo usage is not limited to Sugar's core; some activities use hippo, or they pull on sugar-toolkit classes which are implemented with hippo. These are: Chat (<em>please list others here</em>).
+
One complication is that hippo usage is not limited to Sugar's core; some activities use hippo, or they pull on sugar-toolkit classes which are implemented with hippo. These are: Chat, Speak (<em>please list others here</em>).
 +
 
 +
=== Theme porting ===
 +
 
 +
[[/Theme|Theme status.]]
 +
 
 +
One major internal change in GTK3 is the way that themes are designed. GTK2 allowed themes to be implemented with a special format in a gtkrc file, but GTK3 now requires that themes are implemented using CSS. Therefore another non-trivial prerequisite for a GTK3-based sugar release of any visual component is the porting of the theme.
 +
 
 +
Fortunately, the gtkrc file format does not seem to be too far away from css (i.e. it applies attributes to classes in a textual format), and css is well known and well documented, so hopefully this is not a major challenge. For an example of the old GTK2 style, see <tt>/usr/share/themes/Adwaita/gtk-2.0/gtkrc</tt>, and for a GTK3 CSS example see <tt>/usr/share/themes/Adwaita/gtk-3.0/gtk-widgets.css</tt>
    
=== Backwards-compatibility for activities ===
 
=== Backwards-compatibility for activities ===
Line 68: Line 77:  
As we do not have plentiful developer resources, I propose that the PyGTK/GTK2 version of sugar-toolkit is frozen as soon as this feature development is underway. No bugfixes or improvements, just a copy of the code at that point.
 
As we do not have plentiful developer resources, I propose that the PyGTK/GTK2 version of sugar-toolkit is frozen as soon as this feature development is underway. No bugfixes or improvements, just a copy of the code at that point.
   −
==== Selecting a sugar-toolkit version ====
+
The GTK3 version of sugar-toolkit would be installed under a new module named <b>sugar1</b>, distinguishing it from the frozen GTK2 <b>sugar</b> version to be removed later. All code will need extensive textual changes in moving to GTK3, changing "import sugar.foo" to "import sugar1.foo" will just be another step in that process.
   −
With two versions of sugar-toolkit available, activities need a mechanism for choosing which toolkit they will use. As we require existing activities to continue working without modifications, this selection mechanism must be <em>opt-in</em> - ported activities must somehow mark themselves as being GTK3-ported, and hence will receive the GTK3 version of sugar-toolkit, and all other activities will receive the GTK2 version.
+
The removal of the GTK2 sugar-toolkit version would happen one year after the first stable release of a sugar-toolkit that includes GTK3 support. In this context, 'removal' means that it gets deleted from the sugar-toolkit master branch of the git tree. Old versions of sugar-toolkit will of course be left available, in old git branches and release tarballs.
 
  −
One easy way to achieve this would be to give the GTK3 version of sugar-toolkit a different name. The unported GTK2 activities could continue to <tt>import sugar.foo</tt> and ported GTK3 activities would <tt>import sugar1.foo</tt>. "sugar1" is chosen as an example to indicate Sugar-1.0, but other naming schemes would obviously work equally well.
  −
 
  −
If the community has strongly desires it, it would be possible maintain the <tt>sugar</tt> module name through a Python trick which could be deployed during the transition period, and then removed once the GTK2 version is dropped. Here is how it could be done:
  −
 
  −
* The new GTK3 version of sugar toolkit would be installed with name <tt>sugar</tt>, and the old GTK2 version would be installed with name <tt>sugar_gtk2</tt>.
  −
* Before <tt>sugar-activity</tt> imports sugar.activity (or any other sugar-toolkit class), it would look for an empty file called "GTK3_PORTED" in the activity's directory. If present, it would run a little trick:
  −
import os
  −
import sys
  −
if not os.path.exists("GTK3_PORTED"):
  −
    import sugar_gtk2
  −
    sys.modules["sugar"] = sugar_gtk2
  −
* The result is that all unported/unmodified activities (without the GTK3_PORTED file) would <tt>import sugar.foo</tt> as before, but the above trick that modifies Python's module table would result in them (transparently, magically, automatically) being redirected to sugar_gtk2.foo.
  −
* At the end of the transition period, sugar_gtk2 would be deleted in entirity, the above addition to sugar-activity would be dropped, and activities could drop the GTK3_PORTED files at their leisure.
  −
 
  −
Further consideration must be given to sugar-base. This package installs some classes which are then used by sugar-toolkit, so they would need to be duplicated into sugar_gtk2. This may be a good opportunity to consider merging sugar-base with sugar-toolkit.
      
=== Proposed plan of action ===
 
=== Proposed plan of action ===
   −
The steps below prioritise the porting of sugar-toolkit, as this is where Sugar would see the most immediate benefit: the revival of Browse and Read. The steps that follow can largely be parallelised.
+
The steps below prioritise the porting of sugar-toolkit, as this is where Sugar would see the most immediate benefit: the revival of Browse and Read. The steps that follow can largely be parallelised; the important bit is placing sugar-toolkit first in line.
    
# Remove hippocanvas from sugar-toolkit
 
# Remove hippocanvas from sugar-toolkit
# Port sugar-toolkit to GTK3 while keeping backwards compatibility
+
# Port sugar theme to GTK3
 +
# Port sugar-toolkit to GTK3 while keeping backwards compatibility, release as sugar-toolkit-0.95.x
 
# Rescue Browse and Read, and allow independent activity porting efforts to begin
 
# Rescue Browse and Read, and allow independent activity porting efforts to begin
 
# Remove hippocanvas from all other parts of Sugar, including activities
 
# Remove hippocanvas from all other parts of Sugar, including activities
# Port Sugar core to hippocanvas
+
# Port Sugar core to GTK3
# Some time later, remove sugar-toolkit's GTK2 compatibility.
+
# Remove sugar-toolkit's GTK2 compatibility one year after the first GTK3 sugar-toolkit stable release
#* I propose that this happens 1 year after release of the first sugar-toolkit GTK3 version
      
=== How to port ===
 
=== How to port ===
Line 111: Line 104:  
#* The [http://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html Migrating from GTK+ 2.x to GTK+ 3] should also be read.
 
#* The [http://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html Migrating from GTK+ 2.x to GTK+ 3] should also be read.
   −
=== Version number considerations ===
+
== Other considerations ==
 +
 
 +
=== Version number ===
    
It goes without saying that such a migration would be the basis of a new major release. When this topic has been discussed before, people have toyed with the idea of calling the GTK3 version of Sugar "Sugar-1.0".
 
It goes without saying that such a migration would be the basis of a new major release. When this topic has been discussed before, people have toyed with the idea of calling the GTK3 version of Sugar "Sugar-1.0".
Line 121: Line 116:  
And there are arguments against:
 
And there are arguments against:
 
* Some people might interpret the number 1.0 as indicating a higher level of maturity than what the developers feel
 
* Some people might interpret the number 1.0 as indicating a higher level of maturity than what the developers feel
 +
* Some developers have very specific ideas about what should be included in Sugar-1.0, even if development of such items is barely even on the horizon
 
* Some people want a much longer lead-up time to Sugar-1.0 so that the API can be refined/reworked/perfected
 
* Some people want a much longer lead-up time to Sugar-1.0 so that the API can be refined/reworked/perfected
   −
Tomeu, Simon and Marco agreed that the 1.0 version number could be used here, and communicated in a slightly different sense: we are really still in the first iteration and 1.0 will be when that first iteration reaches maturity, without big changes in the API. After 1.0 we can start working on what will be one day 2.0 which should be the second iteration of Sugar, hopefully using what we have learned during these years.
+
Tomeu, Simon and Marco agreed that the 1.0 version number could be used here, and communicated in a slightly different sense: "we are really still in the first iteration and 1.0 will be when that first iteration reaches maturity, without big changes in the API. After 1.0 we can start working on what will be one day 2.0 which should be the second iteration of Sugar, hopefully using what we have learned during these years."
   −
The migration of sugar-toolkit, sugar, datastore, etc, is likely to take more than 1 release cycle, but the above scheme can still apply. When each component is ported to GTK3, it would then pick up the 1.0 tag. For example, the first major release that includes any GTK3 may well include sugar-toolkit-1.0 (GTK3 ported) alongside sugar-datastore-0.96 (not yet ported).
+
However, current Sugar developers feel strongly that the changes described here are not significant to warrant a major version bump and have specific ideas about what should be included in a 1.0 release. Therefore, in the interest of being slightly less intrusive, this feature does not ultimately propose a version numbering change - it is planned that sugar-toolkit-0.96 will be released as the first with GTK3 support, and once we reach sugar-0.98, the next releases will be 0.100, 0.102, etc.
 +
 
 +
=== Retaining the 'sugar' module name ===
 +
 
 +
The strategy suggested above involves the GTK3 sugar-toolkit version being installed with the 'sugar1' module name. It would be possible to retain the 'sugar' name for this module via a Python trick documented below, but it appears that there is no demand for this from the community. Porting to GTK3 requires major textual changes anyway, changing 'sugar' to 'sugar1' in the same files is therefore regarded as acceptable. Here is how the naming trick could be done anyway:
 +
 
 +
* The new GTK3 version of sugar toolkit would be installed with name <tt>sugar</tt>, and the old GTK2 version would be installed with name <tt>sugar_gtk2</tt>.
 +
* Before <tt>sugar-activity</tt> imports sugar.activity (or any other sugar-toolkit class), it would look for an empty file called "GTK3_PORTED" in the activity's directory. If present, it would run a little trick:
 +
import os
 +
import sys
 +
if not os.path.exists("GTK3_PORTED"):
 +
    import sugar_gtk2
 +
    sys.modules["sugar"] = sugar_gtk2
 +
* The result is that all unported/unmodified activities (without the GTK3_PORTED file) would <tt>import sugar.foo</tt> as before, but the above trick that modifies Python's module table would result in them (transparently, magically, automatically) being redirected to sugar_gtk2.foo.
 +
* At the end of the transition period, sugar_gtk2 would be deleted in entirity, the above addition to sugar-activity would be dropped, and activities could drop the GTK3_PORTED files at their leisure.
 +
 
 +
Further consideration would need to be given to sugar-base. This package installs some classes which are then used by sugar-toolkit, so they would need to be duplicated into sugar_gtk2.
 +
 
 +
=== Python 3 ===
 +
 
 +
Is it worth throwing in a Python 3 migration into this project? I have researched the issue, and my opinion is: no.
 +
 
 +
* Python 3 brings no immediate obvious benefit, and does not fix any pressing problems. On the other hand, PyGI solves some clear breakage for us.
 +
* Python 3 (or rather the code that supports it) is not mature. Many modules are still Python2-only.
 +
* PyGI does support Python 3, but it was [http://mail.gnome.org/archives/python-hackers-list/2011-July/msg00000.html broken] when I tried it. It is not seeing much attention.
 +
* Our neighbours within GNOME and other open source projects are only just starting to play with Python 3. There is not much similar experience we can build upon. There may be teething problems, such as modules that Sugar uses that haven't been ported, and bugs in existing ports due to lack of use (such as the fact that PyGI was broken for quite a while with nobody noticing) that hold us back. This is not so for the PyGI transition, where we can look at many PyGTK applications that have been ported and that are actively used.
 +
* J5 (PyGI developer) suggested that we avoid combining the 2 migrations. It would add more change to an already disruptive project, and increases the risk. It would be better to limit the amount of change we introduce, so that risk is more manageable and to decrease the number of problems and challenges that we face.
 +
* If the above situation does change, the Python 3 migration will be much easier than this one. Py3 migration does not require invasive code changes. It will be much easier to have Python 2 and 3 support maintained in parallel. The few existing projects that have done this are able to maintain Python2 and Python3 support in the same codebase, without too many if conditions. The "if we're already making so much change, why not avoid a future migration period by including Py3" argument is not very strong, because the Py3 migration will be much smoother and less complex.
    
== API changes ==
 
== API changes ==
Line 160: Line 183:     
In the event of problems in the GTK3 version of sugar-toolkit, activity authors have the (default) choice of staying with GTK2. The transition period before the GTK2 version is removed would obviously be extended in the face of significant problems with GTK3 version.
 
In the event of problems in the GTK3 version of sugar-toolkit, activity authors have the (default) choice of staying with GTK2. The transition period before the GTK2 version is removed would obviously be extended in the face of significant problems with GTK3 version.
 +
 +
== Documentation ==
 +
* [[Features/GTK3/Development | Development page]]
 +
* [[Features/GTK3/Porting | Activity porting guide]]
    
== Release Notes ==
 
== Release Notes ==
 +
 +
== Hackfests ==
 +
 +
This work would benefit from some focused attention at in-person meetings.
 +
 +
See [[Features/GTK3/Desktop Summit activities]] for earlier desktop summit ideas.
 +
 +
On September 10th-12th, a SugarCamp will be held in Paris. We will be working on this plan at the event, starting with the prerequisites.
 +
 +
On October 28th-30th, a hackfest will be held in Prague with the specific purpose of implementing this plan: [[Marketing_Team/Events/Gtk3_Hackfest_2011]]
    
== Comments and Discussion ==
 
== Comments and Discussion ==
 
* See [[{{TALKPAGENAME}}|discussion tab for this feature]]
 
* See [[{{TALKPAGENAME}}|discussion tab for this feature]]
 +
== Subpages ==
 +
{{Special:PrefixIndex/{{PAGENAMEE}}/}}
628

edits

Navigation menu