Kodi Community Forum
GSOC 2k17 - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: GSoC (https://forum.kodi.tv/forumdisplay.php?fid=299)
+----- Forum: GSOC 2017 (https://forum.kodi.tv/forumdisplay.php?fid=274)
+----- Thread: GSOC 2k17 (/showthread.php?tid=309218)



GSOC 2k17 - arpitn30 - 2017-03-09

Hello, I'm a computer science undergraduate student in the pre final year of my college. I work on Python on a regular basis along with javascript and MySQL/PostgreSQL on the frontend and the backend while developing websites. I'm well versed with linux environment c++ as well. Some of my opensource projects can be seen on my github profile https://github.com/arpitn30.

I looked into the projects mentioned on your page and some of ideas really fascinated me. I found the Web Browse and Retro Player really interesting. I'm also interested to add Python3 support. It would really be helpful if someone could guide me on how to proceed further so I can begin working on it early on.


RE: GSOC 2k17 - Razze - 2017-03-10

Hey there, welcome!

First of all I think you will have to settle for one direction as one of those ideas is enought for an summer, at least that's what we're thinking.

The best thing for you to do right now is to try to find out which one you would like to investigate and maybe try to get kodi to build on your machine.
http://kodi.wiki/view/Category:Compiling


RE: GSOC 2k17 - RockerC - 2017-03-10

@arpitn30, other than compiling Kodi and looking at the code, you and other students should really checkout all the accepted proposals from previous years of GSoC:

http://forum.kodi.tv/forumdisplay.php?fid=220
http://forum.kodi.tv/forumdisplay.php?fid=191
http://forum.kodi.tv/forumdisplay.php?fid=161

If you read through all those accepted proposals then you should get an idea how to write your own proposal and how-to engage with the community here on the forum.

Another tip from previous years not mentioned here yet is to submit your proposal(s) early as you can always make changes to details of your proposal(s).

You can submit more than one prososal. You could post one seperate proposal for each idea, as that means less risk all of your ideas conflict with other students.

Advice from looking at previous years would be; submit early, submit many, submit revisions often, and get feedback in back-and-forth discussions with community.


RE: GSOC 2k17 - arpitn30 - 2017-03-12

For now I'm focussing on both Python3 support and Kodi chromium browser and trying to understand the code before finalising for my proposal. I just wanted to know if there is any documentation or list of features expected to be added in the Kodi browser?


RE: GSOC 2k17 - da-anda - 2017-03-12

as for Python3 - there is currently some work done to improve our interfaces and ease the way to integrate new languages. This work is done by AlwinEsch/alwinus in the Kodi-agile fork https://github.com/FernetMenta/kodi-agile and will be merged to mainline once finished. So if you're interested in this, it might be good to check out this work instead of current master.


RE: GSOC 2k17 - RockerC - 2017-03-13

(2017-03-12, 08:25)arpitn30 Wrote: For now I'm focussing on both Python3 support and Kodi chromium browser and trying to understand the code before finalising for my proposal.
Suggest that you submit two seperate proposals if that is the case; so one proposal for Python3 and one proposal for integrated web browser.

(2017-03-12, 08:25)arpitn30 Wrote: I just wanted to know if there is any documentation or list of features expected to be added in the Kodi browser?
Not still maintained but see repositories under "kodi-web", "AlwinEsch" (alwinus), and "AchimTuran" (wisler) on GitHub:

https://github.com/kodi-web

https://github.com/AlwinEsch

https://github.com/AchimTuran

Also checkout existing discussions with "alwinus" (Alwin Esch), "wisler" (Achim Turan), and other devs in threads like:

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

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

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

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

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

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


RE: GSOC 2k17 - arpitn30 - 2017-03-13

Thanks a lot, I'll check it out


RE: GSOC 2k17 - arpitn30 - 2017-03-14

(2017-03-12, 12:57)da-anda Wrote: as for Python3 - there is currently some work done to improve our interfaces and ease the way to integrate new languages.

I'm a bit confused. Does the entire code base including system files, add-ons and the libraries for development has to be changed to be compatible with both Python 2.7 and Python 3.6 or we have to add the python3 support to the KODI api for script and plugin development. For the latter, the API will have to be shipped with both Python 2.7 and 3.6 interpreter as well as updated xmbc modules


RE: GSOC 2k17 - docwra - 2017-03-14

I'd suggest keeping the project simple.

Something like adding CDart support(and other artwork types) with the new python scrapers could be an awesome little project.


RE: GSOC 2k17 - Razze - 2017-03-15

(2017-03-14, 06:41)arpitn30 Wrote:
(2017-03-12, 12:57)da-anda Wrote: as for Python3 - there is currently some work done to improve our interfaces and ease the way to integrate new languages.

I'm a bit confused. Does the entire code base including system files, add-ons and the libraries for development has to be changed to be compatible with both Python 2.7 and Python 3.6 or we have to add the python3 support to the KODI api for script and plugin development. For the latter, the API will have to be shipped with both Python 2.7 and 3.6 interpreter as well as updated xmbc modules

You will basically have to look at SWIG and how to generate a SWIG binding for python 3 additionally to the one for python 2 that we have. Then bind that to the language binaries somehow. Have something to control which language loads an addon (addon.xml probably). Make kodi able to use that and maybe an addon to proof that it works with python 3.

You can have a look at this untested branch on how the SWIG stuff might look https://github.com/Razzeee/xbmc/tree/python3-swig


RE: GSOC 2k17 - RockerC - 2017-03-15

(2017-03-14, 06:41)arpitn30 Wrote:
(2017-03-12, 12:57)da-anda Wrote: as for Python3 - there is currently some work done to improve our interfaces and ease the way to integrate new languages.

I'm a bit confused. Does the entire code base including system files, add-ons and the libraries for development has to be changed to be compatible with both Python 2.7 and Python 3.6 or we have to add the python3 support to the KODI api for script and plugin development. For the latter, the API will have to be shipped with both Python 2.7 and 3.6 interpreter as well as updated xmbc modules
For dicussion about an Python3 upgrade also reading discussions in these two threads:

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

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

Sounds as if the "six compatibility package" is no longer the best option for supporting both Python 2 and 3 in Kodi.

http://forum.kodi.tv/showthread.php?tid=205204&pid=2478984#pid2478984

Today the "future compatibility package" (python-future) is the future of "easy, clean, reliable Python 2/3 compatibility":

http://python-future.org/overview.html
(2016-12-15, 01:56)Hedda Wrote: Don't know about Kodi's core interface to Python, but as plain Python scripting language goes it should today be much smoother to upgrade to Python 3 and stay backwards compatible with Python 2 as there is now a new compatibility package that should make running Python 2 scripts under Python 3 easier.

Checkout: http://python-future.org/overview.html
Quote: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.

It provides future and past packages with backports and forward ports of features from Python 3 and 2. It also comes with futurize and pasteurize, customized 2to3-based scripts that helps you to convert either Py2 or Py3 code easily to support both Python 2 and 3 in a single clean Py3-style codebase, module by module.

Notable projects that use python-future for Python 2/3 compatibility are Mezzanine and ObsPy.
As before it was adviced that if you upgraded to Python 3.x interpreter then you could still keep some backwards compatibility with Python 2.7 if you use the "six compatibility package" (for reference see http://packages.python.org/six/ ).

Now however the Python interpreter developers have made a new compatibility package that is called "python-future" (and it is also refered to as "future compatibility package"), so please see:

http://python-future.org/index.html ( and the actual package on GitHub https://github.com/PythonCharmers/python-future )

This "future compatibility package" is still in beta and doesn't support as many versions of Python as the 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).

Recommmed that you read both https://wiki.python.org/moin/Python2orPython3 and http://python-future.org/index.html

It suggest that much modern Python code should run largely unmodified on Python 3 using this "future compatibility package".



RE: GSOC 2k17 - arpitn30 - 2017-03-17

(2017-03-17, 12:12)Roman_V_M Wrote: Having both Python 2 and 3 interpreters (if it's possible at all) will be good because addons have been developed over the years by many authors, many of whom are not professional coders, so it's hard to expect them all to port their addons to Py3 or refactor to universal code. If we replace the interpreter, we will inevitably loose some addons because of compatibility issues.

The Standard Library aside, the main difference between Py2 and Py3 is clear separation between textual and byte strings. Currently, Kodi API functions that take textual data accept both str and unicode Py2 types. AFAIU unicode is transparently encoded to utf-8 by SWIG and passed as std:Confusedtring or char* to the Kodi core. In Py3 str type holds Unicode codepoints and bytes type is used for raw bytes. I thinks it would be totally OK if in Python 3 Kodi API functions would accept and return only str (that is, Unicode) data and not bytes.

Also, Kodi provides some binary Python libraries like PIL/Pillow that are compiled in place during Kodi building. Binary Python libraries must be compiled and linked against the target Python version, so I'm not sure if it is possible to have 2 versions of such libraries if we ever consider to support both Py2 and Py3.

Is it possible to migrate all the add-ons to python3 as well?
It could serve as a separate soc idea. There are around a 200+ python files in add-ons, it wouldn't be very hard to convert them using PyCharm and the futurise script. Although I've a vague idea to support the build time compile libraries, shipping both py2 and py3 interpreter would take a lot of space and quite possibly slow down the software as well.


RE: GSOC 2k17 - da-anda - 2017-03-17

v2 and v3 IMO should run in parallel for at least 1 Kodi version to ease transition


RE: GSOC 2k17 - Razze - 2017-03-18

(2017-03-17, 15:33)arpitn30 Wrote:
(2017-03-17, 12:12)Roman_V_M Wrote: Having both Python 2 and 3 interpreters (if it's possible at all) will be good because addons have been developed over the years by many authors, many of whom are not professional coders, so it's hard to expect them all to port their addons to Py3 or refactor to universal code. If we replace the interpreter, we will inevitably loose some addons because of compatibility issues.

The Standard Library aside, the main difference between Py2 and Py3 is clear separation between textual and byte strings. Currently, Kodi API functions that take textual data accept both str and unicode Py2 types. AFAIU unicode is transparently encoded to utf-8 by SWIG and passed as std:Confusedtring or char* to the Kodi core. In Py3 str type holds Unicode codepoints and bytes type is used for raw bytes. I thinks it would be totally OK if in Python 3 Kodi API functions would accept and return only str (that is, Unicode) data and not bytes.

Also, Kodi provides some binary Python libraries like PIL/Pillow that are compiled in place during Kodi building. Binary Python libraries must be compiled and linked against the target Python version, so I'm not sure if it is possible to have 2 versions of such libraries if we ever consider to support both Py2 and Py3.

Is it possible to migrate all the add-ons to python3 as well?
It could serve as a separate soc idea. There are around a 200+ python files in add-ons, it wouldn't be very hard to convert them using PyCharm and the futurise script. Although I've a vague idea to support the build time compile libraries, shipping both py2 and py3 interpreter would take a lot of space and quite possibly slow down the software as well.

Well might be possible on paper, but we don't want you to update the code of a third party app developer. As you would have to push your code to their repos also and that will be a logistical nightmare. And "force" updating another ones addon to a new python version without asking them first is not something I would like.


RE: GSOC 2k17 - arpitn30 - 2017-03-18

Yeah, I guess, we need to provide support for both versions for at least 1 version in order to give the third party developers a chance to port their add-ons. Though a full Python3 support is needed sooner rather than later since Python 2.7 won't be maintained after 2020 - https://pythonclock.org/.