Tribler: Backporting to Python 2.6

Created on 21 Apr 2017  路  17Comments  路  Source: Tribler/tribler

I have noticed that Python 2.6 is not supported by Tribler Core.

see:
https://github.com/hbiyik/script.module.triblercore/commit/fb790c242575c42a55a8830fb1fbaec1f429af54

Problems i have noticed:
1) argparse, collections is not supported in py26, i have used backports of those modules
2) even though some modules both exist on p27 & 26 methods and attributes are not idetical. IE on windows with python 2.6 there is no os.kill. I have ported same functionality with ctypes. . Also on android even though with python27, randomfile module raises exceptions sometimes, this is an issue with kodi though. I have shamelessy patched that in a very ugly way :).
3) python26 compiler does not understand dict comprehensions, and as far as i could see they are in alot of places in the code

Python 26 is basically %90 of android kodi users interpreter, even though i hate it, i think i got used to that.
What is yout thoughts on this? Is py26 officially supported, or will be supported? this is kind of blocker.

And also what do you think about creating anew module for compatability issues, all those tricky modules, and methods can be called from there, and tihs can be used as an interface.

This is important because my branch is not sync with devel, if i start to fix those one day same effort will be lost on rebasing and merging. I have only started tribler core with py26 and done some json queries, did not fully fix everything all code needs to be revised.

long-term

Most helpful comment

Kodi is also moving to Python3. Great news.
https://kodi.tv/article/attention-addon-developers-migration-python-3

All 17 comments

hi tribler team, sorry if i keep spamming your issue tracker, i will start rebasing from latest-devel and start to backport to 2.6 hopefully this weekend. Seems like this issue is a boring one, no-one wants to deal with :) if you enjoy the results i can pr when done.
@devos50 @EinNarr @synctext

wow. py26 would be an amazing PR.
Lot of boring work indeed... 90% of Kodi users is a solid argument.

Unit tests and windows,Linux,Mac passing tests might require some lib installs on Jenkins I guess. Good luck with this hard work!

oyeah. please open a WIP PR already today for early feedback by the team

thanks for showing the direction, i will clean up my repo, organise and rebase after that create a wip pr, to receive feedback.

@hbiyik after some discussion, it was decided that it is not a good idea to merge https://github.com/Tribler/tribler/pull/2921 into the official Tribler codebase. The most important reason that led to this decision is that it is too cumbersome to require developers to write python2.6 compatible code. Even though your work is very much appreciated and we would love to have many KODI users using Tribler, there will come a moment where Tribler is ported to python3 and we simply don't have the manpower to maintain both forks.

We propose the following: you fork Tribler and make it backwards compatible for 2.6 and get KODI to work from there. New features are developed in this official Tribler repository and (given that the effort required isn't too large) we will make PR's on your 2.6 fork to keep the two compatible for the near future. We will try to support you using the small amount of time we have. You can use our Jenkins server for continuous integration.

@vandenheuvel, i can see your points, backporting is done in a fashion that main tribler code wont need to be altered much and this will come handy in case of merging, so no need for even a PR i can rebase and merge my backported with the upstream tribler branch easily so you guys dont need to spare time to PR also.

Is there any stable branch including latest functions, is "master" for this purpose? Or should i follow devel?

@hbiyik I recommend you to use the next branch for that. This branch currently contains the code for our first Tribler 7 release candidate and is stable enough for production. The devel branch contains bleeding-edge code with features that might not be tested in the wild yet.

ok agreed, do you want the PR to stay opened or closed? since backport merging is a long deadline for your agenda, may be before official releases or may be before tagging, it will stay long in there if i dont close :).

Please make Kodi operational with Tribler first with with py2.7 and get a smaller user base from there. With a fully working app then focus on py2.6 support. Full userbase. Good roadmap?

@synctext py26 backport is already done in this pr, the discussion was how to manage the codebase. And i will use a fork of tribler + dispersy and maintain it, and einarr can depend my fork. if we were to go without android and py26 it would fail without question. i have been there before.

@synctext if a 2.6 fork will be made, @hbiyik might as well start with 2.6 right away. Getting it to work with 2.7 first is only beneficial if the 2.6 backwards compatibility has to be merged into the official repository.

Dispersy on py2.6 might take some time. right? Tribler should run OK on our Google Pixel Android devices.

@synctext nah, it is also already done,
https://github.com/hbiyik/dispersy/commit/03a7dfb510ba1d28763c84dd6984993798147f43
https://github.com/hbiyik/dispersy/commit/2969de4532dde150407d49636e5d1d272e778b04

again the question is future maintenance and im green with it.

as long as Arm7a, it should run ok with all androids starting from 3.x something.

Can this issue be closed? The end-of-life of Python 2.6 was more than five years ago and https://snarky.ca/stop-using-python-2-6 was written three years ago.

It is very unlikely that we will continue with this since we already have trouble porting to Python 3. I will close this issue.

Kodi is also moving to Python3. Great news.
https://kodi.tv/article/attention-addon-developers-migration-python-3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hbiyik picture hbiyik  路  5Comments

ichorid picture ichorid  路  8Comments

N0rbert picture N0rbert  路  3Comments

Nubro01 picture Nubro01  路  4Comments

filicado picture filicado  路  9Comments