Time to upgrade Kodi to Python 3.x interpreter version such as Python 3.3?
#1
Does Team-Kodi have plans on upgrading Kodi's built-in Python interpreter to support at least Python 3.3 scripts soon?

Perhaps the next Kodi version might be a good point to break backwards compatibility if that is what is required?


Having support for both Python 2.x and Python 3.x might be nice but it should by now not hold new Kodi addons back.

http://wiki.python.org/moin/Python2orPython3
Quote:Supporting Python 2 and Python 3 in a common code base

The common subset of Python 2.6+ and Python 3.3+ is quite large - the restoration of u prefix support for unicode literals in Python 3.3 means that semantically correct Python 2.6+ code can be made source compatible with Python 3.3+ while still remaining largely idiomatic Python. The main difference is that some things will need to be imported from different places in order to handle the fact they have different names in Python 2 and Python 3.

Accordingly, the six compatibility package ( http://packages.python.org/six/ ) is a key utility for supporting Python 2 and Python 3 in a single code base.

The future compatibility package ( http://python-future.org/index.html ) is still in beta and doesn't support as many versions of Python as six (it only goes back as far as Python 2.6, while six supports Python 2.4), but allows Python 2 compatible code to be written in a style that is closer to idiomatic Python 3 (for example, it includes an actual Python 2 compatible implementation of the Python 3 bytes type, rather than relying on the Python 2.x 8-bit string type that exposes a slightly different API).

Point is that while it's possible to support both, Python 2.x is legacy, Python 3.x is the present and future of Python.

Python 3.0 was released in 2008, and the final 2.x version 2.7 release came out in mid-2010.

It is now almost the year 2015, maybe time to move on? Rationale here http://legacy.python.org/dev/peps/pep-0387/
Reply
#2
Changing to 3.x is not costless. It would impose SIGNIFICANT costs on addon developers.

Is there some gain for the pain?
Reply
#3
Indeed, upgrading to Python 3.x would break compatibility for all existing addons.
However, I guess it is possible to add Python 3 interpreter as an option to let addon developers choose between Python 2 and 3.
And to distinguish between Python 2 and 3 addons a new tag could be added to addon.xml. For example:
Code:
<requires>
<import addon="python" version="2.7"/>
...
<requires>
or
Code:
<requires>
<import addon="python" version="3.4"/>
...
<requires>
And if the tag is missing Kodi assumes by default that it is for Python 2.7 to keep compatibility with existing addons.
As for XBMC Python API classes written in C++ and exposed to Python via SWIG, I don't see problems here. Those classes are exposed as "new" Python classes and in Python 3 all classes are "new" by design.
IMO this is the only way to implement Python 3 and to keep compatibility with a host of existing addons.
Reply
#4
Yes it should be technically possible for Kodi to support both Python 2.6, Python 2.7, and Python 3.4 then just have an option for the addon to choose which interpreter version to use.

Again checkout this section in Python wiki http://wiki.python.org/moin/Python2orPython3
Quote:Supporting Python 2 and Python 3 in a common code base

The common subset of Python 2.6+ and Python 3.3+ is quite large - the restoration of u prefix support for unicode literals in Python 3.3 means that semantically correct Python 2.6+ code can be made source compatible with Python 3.3+ while still remaining largely idiomatic Python. The main difference is that some things will need to be imported from different places in order to handle the fact they have different names in Python 2 and Python 3.

Accordingly, the six compatibility package ( http://packages.python.org/six/ ) is a key utility for supporting Python 2 and Python 3 in a single code base.

The future compatibility package ( http://python-future.org/index.html ) is still in beta and doesn't support as many versions of Python as six (it only goes back as far as Python 2.6, while six supports Python 2.4), but allows Python 2 compatible code to be written in a style that is closer to idiomatic Python 3 (for example, it includes an actual Python 2 compatible implementation of the Python 3 bytes type, rather than relying on the Python 2.x 8-bit string type that exposes a slightly different API).
But unless the Python interpreters get moved into binary addons themselves (which could also be possible) this would probably greatly increase the Kodi package size.
Reply
#5
First you should get everything upgraded to 2.7. Android, ios/osx and windows still use python 2.6. I don't know why they haven't moved to 2.7 yet..


(2014-09-26, 15:30)Karnagious Wrote: Changing to 3.x is not costless. It would impose SIGNIFICANT costs on addon developers.

Is there some gain for the pain?
You can uncaps that because in 99% of the cases, porting to python 3 is trivial and requires only a parentheses and import fix here and there, which you can do automatically with 2to3.
Reply
#6
And the other 1%?
Reply
#7
(2014-10-15, 22:03)takoi Wrote: First you should get everything upgraded to 2.7. Android, ios/osx and windows still use python 2.6. I don't know why they haven't moved to 2.7 yet..

And what is the connection between the system Python and XBMC Python exactly? This is not to mention the fact that Windows comes without any Python pre-installed.
Reply
#8
before any move to python 3.0 is made some one needs to fix crossbuild on non Windows platforms.
So you first need to fix it to be able to build 2.7 (instead of 2.6 now).
Further than that any discussion is pointless wetter to upgrade or not.

fyi: Windows uses 2.7.3 and is shipped by XBMC/KODI.
Linux uses 2. whatever installed on the system
Android/ios/osx use 2.6.x
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#9
(2014-10-16, 00:40)Karnagious Wrote: And the other 1%?
It's a figure of speech. Can't think of anything other than if you do a lot of byte work (like rely of bytes from stdin) it may need some extra work, but none of that is relevant for addons.

The most work will probably be in fixing unicode, as all the already half-broken addons that mix unicode and byte strings and rely on implicit conversion will be full-broken when moving to python 3.
Reply
#10
(2014-10-16, 12:32)Martijn Wrote: before any move to python 3.0 is made some one needs to fix crossbuild on non Windows platforms.
So you first need to fix it to be able to build 2.7 (instead of 2.6 now).
Further than that any discussion is pointless wetter to upgrade or not.

Where can i find bugs or reports related to these problems? I searched through trac and forum but didnt really found something relating to this.

(2014-10-16, 12:32)Martijn Wrote: fyi: Windows uses 2.7.3 and is shipped by XBMC/KODI.
Linux uses 2. whatever installed on the system
Android/ios/osx use 2.6.x

Where can i find these kind of infos?

Thanks!
Reply
#11
does it look different now when 2.7.12 works?
Reply
#12
upgrading to 2.7 was a huge pita, so I'm unwilling to do that again anytime soon. Are you volunteering?
Reply
#13
(2016-12-13, 21:45)wsnipex Wrote: upgrading to 2.7 was a huge pita, so I'm unwilling to do that again anytime soon. Are you volunteering?

You mean upgrading to Python 3.x? It's better not to. As I said above, it's a breaking change that would be disastrous for addon ecosystem.
Reply
#14
I agree with @Roman_V_M updating to python 3. would break a lot of plugins. Not sure the gain is worth the trouble.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#15
well, it's not like they're gonna keep 2.7 on life support forever.
addon breakage will have to happen sooner or later.
i doubt it's going to hurt any less if we postpone the switch for another four years.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
Time to upgrade Kodi to Python 3.x interpreter version such as Python 3.3?1