Active Topics

 


Reply
Thread Tools
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#31
Originally Posted by xerxes2 View Post
I think that pyotherside works with python2 also but it's highly recommended to stick with three!
See post #3 about thp hint to use Python 2.x. I have myself modified PyOtherSide QML plugin to use Python 2.7 on Sailfish, just to test. But I am using Python 3.3 in my current project.
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.
 
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#32
Some more example code to help you get you started with Python 3 + Qt 5 + PyOtherSide on Sailfish OS:

https://github.com/gpodder/gpodder-sailfish

This might be a bit confusing for newcomers, as gPodder's source tree is now split over multiple Git repositories. If there's interest, I might do a more minimalistic and self-contained example of packaging PyOtherSide apps with Sailfish OS.

As far as Python 2 vs Python 3 is concerned: For new projects on Sailfish OS, use Python 3, as Python 2 is slowly going away (also see PEP 404 and PEP 373 for an idea of how upstream Python sees it - the last planned maintenance release of 2.7 at the moment is May 2015, which is only one and a half years away). I won't make it harder than necessary to build PyOtherSide against Python 2, and patches to improve compatibility are welcome, as long as it doesn't make maintaining the Python 3 version more complicated.

Tools like 2to3 make it really easy to migrate existing Python 2 code to Python 3, and if you've read through python2sucks, you should actually be quite happy that we have Python 3.3 in mer-python3 now

If you've ported your Python app to Sailfish OS already, feel free to post screenshots and a link to the Git repo or website (if available) here in this thread, and consider adding/forking it to https://github.com/sailfishapps so it's easily discoverable.
 

The Following 7 Users Say Thank You to thp For This Useful Post:
Posts: 120 | Thanked: 279 times | Joined on Sep 2009 @ Perth, Australia
#33
Originally Posted by thp View Post
you should actually be quite happy that we have Python 3.3 in mer-python3 now
Thanks Thomas! Great to see gPodder leading the way!

I'm keen to make the switch to Python 3 as soon as it is practical. My code is now Python 2/3 compatible .

However, I also feel where possible, it might be best to make use of the officially supported packages which are part of the target platform, and Sailfish is still on Python 2.7.

An example of this is the python-lxml package, which I require for my app. It's available on Sailfish, but for python 2.7. Do you have any tips on how to handle these situations when packaging for Sailfish?

For development purposes I set up a Python 3 virtualenv in the Sailfish emulator, and installed lxml manually.

Also, I have run in to ssl problems when using Python in mer-python3. It could be that I need to install some more libraries, but openssl is already installed.

Cheers!


Shameless screenshot:

Last edited by mattaustin; 2013-10-25 at 22:12.
 

The Following 5 Users Say Thank You to mattaustin For This Useful Post:
xerxes2's Avatar
Posts: 513 | Thanked: 651 times | Joined on Feb 2011 @ Sweden
#34
I can't seem to build python packages as user in the sdk. Anyone else noticed this?
Code:
+ /usr/lib/rpm/meego/brp-python-hardlink
ln: creating hard link `/home/mersdk/rpmbuild/BUILDROOT/sip-4.15.3-1.i386/usr/lib/python2.7/site-packages/sipdistutils.pyo' => `/home/mersdk/rpmbuild/BUILDROOT/sip-4.15.3-1.i386/usr/lib/python2.7/site-packages/sipdistutils.pyc': Operation not permitted
It must be possible to build packages as user right? Building as root seems to work just fine though. Been using linux since 1998 but can't recall ever having used a hard link before.
__________________
But the WM7 "horse" has a blood lineage tracing back to donkeys such as WM6.5, 6.1, 6.0, 5.1 that was fully neglected for too many years and Microsoft did sweet F all to maintain it (still running on Pocket IE4/6!!).
 
xerxes2's Avatar
Posts: 513 | Thanked: 651 times | Joined on Feb 2011 @ Sweden
#35
@mattaustin

Yeah that is the problem with going with python3, that you will have to hunt down libs and bindings yourself. Do you mean pyopenssl?
https://launchpad.net/pyopenssl

They exist in sailfish for py2 but if you need them for py3 you'll probably have to build them yourself ... or hunt them down in some third party repo.
__________________
But the WM7 "horse" has a blood lineage tracing back to donkeys such as WM6.5, 6.1, 6.0, 5.1 that was fully neglected for too many years and Microsoft did sweet F all to maintain it (still running on Pocket IE4/6!!).
 

The Following User Says Thank You to xerxes2 For This Useful Post:
xerxes2's Avatar
Posts: 513 | Thanked: 651 times | Joined on Feb 2011 @ Sweden
#36
The hard link problem seems to be an issue with vbox in your homedir. It's proably fixable somehow but for now I just switched to using symlinks instead in /usr/lib/rpm/meego/brp-python-hardlink :
Code:
ln -sf $(basename $pyc) "$pyo"
After that I ran into another problem that rpm whined about wrong owner/group but I manage to fix that so now I can happily build python packages as user. And I packaged pyqt for arm too:
Code:
zypper ar http://enlisy.org/~xerxes2/pkg/sailfish/armv7hl/xerxes2-sailfish-armv7hl.repo
zypper ref
zypper in pyqt
I have no working hardware to test arm packages, still waiting for sailfish image for the n950 , so the packages are completely untested. But built with the same spec files as i586 so hopefully they work just fine.
__________________
But the WM7 "horse" has a blood lineage tracing back to donkeys such as WM6.5, 6.1, 6.0, 5.1 that was fully neglected for too many years and Microsoft did sweet F all to maintain it (still running on Pocket IE4/6!!).
 

The Following 4 Users Say Thank You to xerxes2 For This Useful Post:
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#37
Originally Posted by rcolistete View Post
PyOtherSide for Qt5 and Python 3.3, from thp, was updated on August 8th 2013, has better documentation and 4 examples :
http://thp.io/2011/pyotherside/
https://github.com/thp/pyotherside
http://thp.io/2011/pyotherside/doc/classQPython.html
Read here the motivations of thp about PyOtherSide on Qt5.
To use Python 2.x instead of Python 3.3 with PyOtherSide, see thp hint.

So Python developing on Sailfish is again possible, using Qt 5/Qt Quick 2 for GUI and Python for computing, glued by PyOtherSide.
Thomas Perl presentation about PyOtherSide in Qt Developers Day 2013 (Berlin) is available :
"Python 3 and Qt 5 with QML" abstract
"Python 3 and Qt 5 with QML" PDF presentation
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.

Last edited by rcolistete; 2013-11-10 at 18:31.
 

The Following 3 Users Say Thank You to rcolistete For This Useful Post:
Posts: 3,464 | Thanked: 5,107 times | Joined on Feb 2010 @ Gothenburg in Sweden
#38
Originally Posted by rcolistete View Post
Thomas Perl presentation about PyOtherSide in Qt Developers Day 2013 (Berlin) is available :
"Python 3 and Qt 5 with QML" abstract
"Python 3 and Qt 5 with QML" PDF presentation
hmm no video recording from the event?
__________________
Keep safe and healthy
 
EmaNymton's Avatar
Posts: 141 | Thanked: 267 times | Joined on May 2010 @ Germany
#39
Originally Posted by mattaustin View Post
An example of this is the python-lxml package, which I require for my app. It's available on Sailfish, but for python 2.7. Do you have any tips on how to handle these situations when packaging for Sailfish?

For development purposes I set up a Python 3 virtualenv in the Sailfish emulator, and installed lxml manually.
I'm facing the same problem here, I need lxml for python 3. I'm not that expirienced in installing packages without using the repository. Is there any repo in the meantime, which I can use and if not, could you please describe a little more detailed what to do, so I can start coding? Thanks in advance!
 
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#40
Any experience here to be shared about submitting Python software to Jolla Harbour ?
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.
 
Reply


 
Forum Jump


All times are GMT. The time now is 17:31.