[Qgis-developer] plugins.qgis.org - Python
gordon at shieldaig.com
gordon at shieldaig.com
Fri Nov 11 18:12:00 PST 2016
To answer one of my questions:
http://python-future.org/compatible_idioms.html
Therefore futurize (and pasteurize to backport) may be alternatives to
2to3 and allow development of plugin code that works for both QGIS 2 and
QGIS 3.
It would be nice to get some directions to avoid going off in the wrong
direction or add unnecessary overhead.
Gordon
On 2016-11-11 18:50, gordon at shieldaig.com wrote:
> Being somewhat unfamiliar with Python I needed to have a QGIS plugin
> to debug my code.
>
> I modified the QGIS remote debug code for the QGIS 2.99 development
> version. It works on Ubuntu 16.04 and is forked from the GitHub site
> for the qgis-remote-debug plugin.
>
> This brought about a few questions:
>
> 1. Are plugins going to be a complete break from QGIS < 2.99 in
> moving forward to Python 3.5, Qt5.7, etc?
>
> 2. Is 2to3 the only way to go? I didn't use it but it probably would
> have been easier.
>
> 3. Is a plugin supposed to be backward compatible from Python 3.5+
> and Qt5.7 to Python 2.7 or less and Qt4?
>
> 4. How does one code to make the plugin work in the QGIS <= 2.18 and
> QGIS >= 2.99?
>
> 5. How is python-six, python3-six, or pypy-six supposed to be used or
> python-future for that matter?
>
> Any pointers will definitely help me produce more useful code.
>
> Gordon
>
> On 2016-11-10 18:37, gordon at shieldaig.com wrote:
>> The complication is that the plugin has to require a minimum QGIS
>> version of 2.99 but will will only show in the list if it is QGIS 3.0.
>>
>> I have a remote debug version plugin that works on Ubuntu 16.04, QGIS
>> 2.99 dev, and Eclipse Oxygen with PyQGIS3 (Python3) environment and
>> PyDev but getting the code in-place wasn't automatic. I manually
>> copied it over to ~/apps/share/qgis/python/plugins. To use on Ubuntu
>> 16.04 .qgis3 (Python 3) and .qgis2 (Python 2) are hidden folders on
>> Ubuntu - so in Files-View-Show Hidden Files has to be activated before
>> the environment can be setup.
>>
>> How is one supposed to make plugins backward compatible? Import
>> syntax seems to be very different in Python 3 and print statement
>> syntax (among other changes) is also very different. Can plugins pass
>> Python 2 and Python 3 lint checks or compilation? How does one do
>> that? The compiled python files (.pyc) are in a cache folder rather
>> in the same folder as .py files. This is an intentional difference
>> but do they work or are they redundant?
>>
>> Gordon
>>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the Qgis-developer
mailing list