[Qgis-developer] Python 3 / PyQt 5

Matthias Kuhn matthias at opengis.ch
Tue Nov 10 16:03:56 PST 2015


Dear all,

We have been working on bringing QGIS to the latest and greatest of the
very core components QGIS is built around. There is a pull request open
to integrate Python 3 and PyQt5 support.

https://github.com/qgis/QGIS/pull/2430

This pull request is pretty safe to merge and should not affect PyQt4
and Python 2 builds which are shipped to users.
On the other hand, it is the first step towards the next version of QGIS
and allows us (the developers) to effectively start gathering
experiences with these libraries.



A plan of action could look like this:

Develop tools that help with the transition.
For python there are already tools like 2to3 or python-modernize that
can upgrade and even produce code that is (supposed to be) compatible
with both versions. For PyQt there are some scripts available online,
but I had no success with them so far (but feel free to try as well, I
did not investigate in detail). There is also a scratch implementation
for a compatibility library which makes it possible to write code that
works with PyQt4 and PyQt5. It would be awesome to have an extension for
python-modernize, that also fixes PyQt imports and other quirks. This
way plugin developers are not forced to provide two separate versions of
their plugins.
We can already start now with this.

CI
We did not integrate this into travis yet, mainly because of missing
dependencies. Having parallel CI for PyQt4 and PyQt5 will make our life
much, much easier!

Upgrade python tests
It will be best to migrate the tests first. These do not affect
production code and give a good feedback where things can break.

Upgrade core python code
This should be done in a separate branch and only bullet-proof code
should be merged to master before 2.14 (I think the console would be a
good candidate to port already now but keep the rest separated).
Not sure how much worth it is to already start porting this in a
separate branch while development continues in master. It will be a
nightmare to solve the conflicts later.

Provide information to plugin devs
Once we have collected some knowledge about the required steps we can
inform plugin devs with information what kind of tools they can use and
which manual changes are required.

QGIS3
Define what exactly we will want to be in there. This is the part which
I think is really, really important. It's a once-in-a-couple-of-years
chance to change the API. And this is what makes QGIS 3 deserve a major
new version number, Python and PyQt changes are just goodies delivered
at the same time. I assume it would be good if core devs all just wrote
some // TODO QGIS3 comments into the code so we can easily grep to get a
todo list.

Remove the deprecated API
That will be straightforward at the appropriate time. We could even
already hide this API for PyQt5 builds now so early-adopters can point
out issues where we do not provide an equivalent for removed APIs.

OSX
IIRC we have some issues with Qt4 on newer OSX versions. It should be
possible to ship QGIS with Qt5 and PyQt4 for these systems if somebody
is willing to work on it. This should be fully compatible with existing
plugins.

Old platforms
What do we do with platforms with missing pyqt5 (I guess python3
shouldn't be a real problem anywhere). Do we just not ship QGIS 3 there
(Why not...)?

Things like this is why you can tell all your friends it's worth
sponsoring QGIS developer meetings. We work most efficiently on islands
with beaches.

Best regards,
Matthias
OPENGIS.ch

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20151111/bff81888/attachment.sig>


More information about the Qgis-developer mailing list