Kodi Community Forum
Kodi v15: Python Version 3 - Printable Version

Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222)
+--- Forum: Feature Requests (https://forum.kodi.tv/forumdisplay.php?fid=9)
--- Thread: Kodi v15: Python Version 3 (/showthread.php?tid=216598)



Kodi v15: Python Version 3 - robwebset - 2015-01-28

Hi All,

I know it has been asked several times about which python version is used, and we currently use 2.6/2.7 as the base. (I believe that's correct?)

I would like to make a feature request that for v15 it would be nice to update to Python 3 - as it was released in 2008 - it's been around a long time - and now appears to be the default for most projects.

I accept that several addons might require a few changes to get them working with Python 3 - but most major releases of Kodi require a little tweak here and there anyway - and I don't think it's now that unexpected for a major release.

I know we do things like update the orther third party libraries in Kodi - so I thought I'd post a request to schedule in a Python update for v15?

Thoughts?

Thanks
Rob


RE: Kodi v15: Python Version 3 - Martijn - 2015-01-28

To be honest I doubt that going to happen. Bumping python is a huge undertaking.
Since we want to do more rapid releases and breaking some/most/all scripts is a no go at this point. Or we would have it run in parallel with 2.6/2.7

I would love to have python3 as well but don't count on it yet.


RE: Kodi v15: Python Version 3 - Memphiz - 2015-01-29

Yeah i doubt that this is an easy task aswell. Even if python3 is there since 2008 - python managed to be a pita when it comes to crosscompilation (yes even for the last 7 years). TBH i am lucky that it works on all our platforms at all atm ...


RE: Kodi v15: Python Version 3 - ronie - 2015-01-29

(2015-01-29, 00:28)Memphiz Wrote: Yeah i doubt that this is an easy task aswell. Even if python3 is there since 2008 - python managed to be a pita when it comes to crosscompilation (yes even for the last 7 years). TBH i am lucky that it works on all our platforms at all atm ...

any chance of at least updating those apple-ish os's to 2.7?
json parsing (which many addons use) is much faster in 2.7


Re: RE: Kodi v15: Python Version 3 - Martijn - 2015-01-29

(2015-01-29, 00:59)ronie Wrote:
(2015-01-29, 00:28)Memphiz Wrote: Yeah i doubt that this is an easy task aswell. Even if python3 is there since 2008 - python managed to be a pita when it comes to crosscompilation (yes even for the last 7 years). TBH i am lucky that it works on all our platforms at all atm ...

any chance of at least updating those apple-ish os's to 2.7?
json parsing (which many addons use) is much faster in 2.7

That's a problem because cross compile needs to be solved which is a pita.
Might be as much work as upgrading to 3.x


RE: Kodi v15: Python Version 3 - Hedda - 2015-01-29

Have anyone looked into implementing the "Six compatibility package" or the upcoming "Future compatibility package" for Python into Kodi with python3?

"Six compatibility package" or the "Future compatibility package" is suppose to be the key utility for supporting Python 2 and Python 3 in a single code base.

Checkout
http://wiki.python.org/moin/Python2orPython3

"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). "



That is, "Six", and the "Future compatibility package" are Python 2 and 3 Compatibility Library

http://packages.python.org/six/

"Six provides simple utilities for wrapping over differences between Python 2 and Python 3. It is intended to support codebases that work on both Python 2 and 3 without modification. six consists of only one Python file, so it is painless to copy into a project."

http://python-future.org/index.html

"Easy, clean, reliable Python 2/3 compatibility, python-future is the missing compatibility layer between Python 2 and Python 3. It allows you to use a single, clean Python 3.x-compatible codebase to support both Python 2 and Python 3 with minimal overhead."



See previous discussion here, with some suggested workarounds that exists

http://forum.kodi.tv/showthread.php?tid=205204


Time to upgrade Kodi to Python 3.x interpreter version such as Python 3.4?

Does Team-Kodi have plans on upgrading Kodi's built-in Python interpreter to support at least Python 3.4 scripts soon?

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


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:[b]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.

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.

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/ [/i]


This forum uses Lukasz Tkacz MyBB addons.