[QGIS-Developer] Python 3 compatibility

Nyall Dawson nyall.dawson at gmail.com
Wed May 24 15:53:12 PDT 2017

On 25 May 2017 at 00:52, Andreas Plesch <andreasplesch at gmail.com> wrote:
> On my linux system (gentoo) QGis 2.18 is using the system python which is
> set to Python 3 whereas on my windows system QGis 2.18 is using the bundled
> Python 2.
> This lead to me to start to look for which Python is used in processing
> scripts leading to lines such as:
> http_server = ('SimpleHTTPServer', 'http.server')[sys.version_info.major ==
> 2]
> With QGis 3 using Python 3 (I believe), there be will be a desire to write
> scripts and plugins which are compatible with both Python 2 and Python 3.
> Is there a recommendation of how to accomplish this compatibility ?
> Or is the general recommendation to have and maintain separate programs for
> each version ? I suspect the answer is yes here but perhaps there are other
> approaches.

That's what I'd strongly suggest. Otherwise you'll end up with a ton
of branching code trying to maintain compatibility with the older

You could put the existing plugin version into some type of
"maintenance" only mode for 2.x and move all feature development into
a new, clean 3.0 branch.


More information about the QGIS-Developer mailing list