Page 1 of 1 (10 posts)

  • talks about »
  • featured

Tags

Last update:
Fri Dec 14 20:45:20 2018

A Django site.

QGIS Planet

Marco becomes QGIS.org Co-chair

We are very proud to announce that one of our founders and directors Marco Bernasocchi was elected as QGIS.org project steering committee (PSC) co-chair.
With over 10 years of involvement with QGIS (he started working with QGIS 0.6) Marco will serve for the next two years as one of the board members of the QGIS.org association. He is excited to get the chance to work together with the PSC and the fantastic QGIS community to push QGIS even further.
We wish him and the rest of the elected PSC two very successful years full of QGIS awesomeness.
Rock on QGIS!
read more at QGIS Annual General Meeting – 2018

Porting QGIS plugins to API v3 – Strategy and tools

The Release of QGIS 3.0 was a great success and with the first LTR (3.4) scheduled for release this fall, it is now the perfect time to port your plugins to the new API.
QGIS 3.0 is the first major release since September 2013 when QGIS 2.0 was released. During the release cycles of all 2.x releases, the QGIS Python API remained stable. This means that a plugin or script meant to be used in QGIS 2.0 is still working in QGIS 2.18.
The need for a new major release was principally motivated by the update to newer core libraries such as Qt 5 and Python 3. But it also offered a unique opportunity to the development team to tackle long-standing issues and limitations which could not be fixed during the 2.x life cycle. Inevitably, this introduced multiple backward incompatibilities making scripts and plugins unusable in QGIS 3.
In this post, I’d like to share some notes from my latest ports. Obviously, if you need professional help for porting your plugins, don’t hesitate to contact us.

Step 0 – Unit tests

You should already have your code covered by unit tests, but I know, the world is not perfect and at times we have to cut edges and, unfortunately, often unit tests are the ones getting cut.
Porting to a new API version is a great moment to go write unit tests helping to make sure that your plugin will keep on working as before the port.

Step 1 – fix * imports

Before going on, please go and remove all your * imports (like from PyQt4.QtGui import *). They are bad and qgis2to3 cannot handle them. There is no need to already change them to the PyQ5 version, just remove them and add the propper PyQt4 imports. We’ll handle moving to PyQt5 in a later step.

From PEP8: Wildcard imports (from import *) should be avoided, as they make it unclear which names are present in the namespace, confusing both readers and many automated tools.

Step 2 – Versioning strategy

Since having a source code repository is a mandatory requirement for publishing a plugin on plugins.qgis.org, I assume you already know what code versioning is and why you absolutely should be using it.

APIv2 branch

Unless you absolutely want to make your code run on both API 2 and 3 (which might be possible) I strongly suggest to create a branch or your current version called qgis2, API2 or legacy or whatever you want to call it. From now on this branch will be responsible for all your future (probably mainly bugfixes) releases for the 2.x series of QGIS. Remember to edit the metadata.txt file and add your minimum and maximum version (not mandatory but nice for clarity):

qgisMinimumVersion=2.14
qgisMaximumVersion=2.18

Master branch

From now on your master branch will be where all your future development for the 3.x series will happen. Remember to edit the metadata.txt file and add your minimum version:

qgisMinimumVersion=3.0

Step 3 – install the helpers

We created a repository with two dedicated tools to help you migrate your QGIS 2 plugins to QGIS 3: qgis2to3 and qgis2apifinder. Both tools are distributed as a single Python package installable via

pip install qgis2to3

Please note that often for system-wide installation you need sudo.
All the sources and more information can be found at https://github.com/opengisch/qgis_2to3

Step 4 – Python 2 to Python 3 and PyQt4 to PyQt5

The qgis2to3 tool is a copy of the files found in QGIS scripts to allow for quick downloading and simple installation without the need of downloading the whole QGIS repository. This is a set of fixers for the python 2to3 command that will update your Python 2 code to Python 3. The additional fixers will also take care of the PyQt4 to PyQt5 porting as well as some other things.
Running the qgis2to3 command will show a number of changes required. These changes can be applied with -w flag

qgis2to3 -w /path/to/your/plugin

Step 5 – Check for API v2 usages

The qgisapi2finder tool helps you find usages of the QGIS API version 2 and gives hints about potential required changes for API version 3.
It is based on a machine parsing of https://qgis.org/api/api_break.html so the results are as good as the information there.
Also, being a simple text parser, it just gives a hint where to look at. It is by no means a complete tool to find all the possible API incompatibility.
Methods are matched using only their names and not their classes, so there might be various false positives. Also, if the same keyword has been edited in various classes, qgisapi2finder will show you all the available suggestions for that keyword.
You can run qgis2apifinder to get hints on the existence of obsolete code requiring manual porting and suggestions on how to actually deal with it. Please note that qgis2apifinder does hide some very frequent words like [‘layout’, ‘layer’, ‘fields’] from the analysis. You can show those with the --all flag.

qgis2apifinder --all /path/to/plugin
qgis2apifinder --all /path/to/plugin/file.py

Step 6 – update your code

From here on it is all looking at each hint, updating the code and rerunning your tests. A properly configured IDE (stay tuned) could also help in the process.
Some more information can be found at github.com/qgis/QGIS/wiki/Plugin-migration-to-QGIS-3
Also, take a look at the PyQGIS API documentation now online at python.qgis.org/master.
I hope this post and tool can help you porting your plugins to QGIS3 and again if you need professional help for porting your plugins, don’t hesitate to contact us.

Geometry generator symbology

Say hello to geometry generators, a new way to use expression syntax to generate a geometry on the fly during the rendering process.
See more ›

QField for Android 5

It's done, QField runs on any android from 4.0.3 (ICS) with a seamless installing experience. We suggest using at least Android 4.3
See more ›

QGIS Crowdfunding: 2.5D Rendering

2.5D rendering

QField in the wild

QField Experimental is out, after a couple of months of requirements gathering, private early alpha testing and foremost tons of emails requesting access to the testes group we decided today to put the current BETA version in the playstore. This means that from now on you can install QField just like any other android app by using the playstore.

QField app on Google Play
See more ›

QGIS Mobile 0.2 Demo

It is with great pleasure the we want to share with you the demo video of version 0.2. of QGIS Mobile (temporary name) is a touch optimized interface for field work developed by OPENGIS.ch. The QGIS mobile 0.2 video demonstrates some basic functionality like navigation, feature identification and attribute editing. The QField 0.2 video demonstrates some basic functionality like navigation, feature identification and attribute editing.

Happy new year to the power of two!

For the first time we at OPENGIS.ch can celebrate with 2 people, Marco Bernasocchi and Matthias Kuhn both experienced QGIS developers and holders of a Master degree in GIScience. After having worked individually in the last years, we have realized that there is a huge potential for us to join our knowledge - because the whole is greater than the sum of its parts. This is why starting from January 1st, 2015 we are working together as OPENGIS.ch LLC.

QGIS 2.0 nightly features review

The last few weeks have been super exciting and intense in terms of QGIS development. I’ve been working a lot and sleeping little to get the latest and greatest stuff to you in the nightly packages. Beside the whole UI and stability work, the nicest feature is probably the mbtiles support. mbtiles are raster tiles in a sqlite database and are blazing fast, have a look at it in the video below.

InaSAFE wins Open Source ‘Rookie of the Year’ award

From Tim’s post:

Rookie_Award_2012 A couple of weeks ago I had the pleasure of doing an interview on behalf of the InaSAFE project as part of the selection process for the Black Duck Software ‘open source rookies of the year’ competition. A week later we heard that we had made it into the top 10! The award is based on a selection or projects from the popular ohlog.net web site:

“Using data on open source projects from Ohloh.net and the Black Duck® KnowledgeBase™, Black Duck reviewed thousands of open source projects that were initiated in 2012 to select the fifth annual Open Source Rookies of the Year. Using a weighted scoring system, points were awarded based on project activity, commits pace, project team attributes and other factors. Black Duck determined the top 10 Rookie projects following an audit of its findings and normalization of scores.”

You can see all the winners listed at the official competition page here. We were also fortunate to be mentioned in Wired, DirectionsMag and various other places.

We have worked incredibly hard over the last year to make the InaSAFE plugin for QGIS, with a team of dedicated developers from AUSAID, WorldBank, Linfiniti, opengis.ch and a number of other developers and contributors, so it is really great to receive this acknowledgement! Here is looking to another great year of working on InaSAFE for 2013!

“We are pleased to recognize InaSAFE as one of the 2012 Open Source Rookies of the Year,” said Tim Yeaton, CEO and president, Black Duck Software. “The Rookies demonstrate how community innovation, particularly within the JavaScript and mobile projects, mirrors the need for innovation in web experiences, mobile devices and enterprise application. Being able to identify and showcase these up-and-coming open source projects is an important part of our mission at Black Duck to bring together the open source community and businesses around the world.”

Past winners of the prestigious award include Twitter Bootstrap, Cloud Foundry, Mozilla Persona (formerly known as BrowserID), Red Hat OpenShift, Eclipse Orion, Apache Rave, Salt Stack, OpenStack, Diaspora and many other notable projects.

I’m really happy to be part of this team and I look forward to more hacking (in the original sense of course) together, Great job guys

  • Page 1 of 1 ( 10 posts )
  • featured

Back to Top

Sponsors