typical workflow for addon dev
#1
First post here after lurking for a few years, and xbmc user since when it only ran on an xbox.
I'm not new at all to python dev but new to kodi addon development.

I am curious as to what does your typical development workflow looks like for kodi addons.
I ask because the only way (so far as I can tell) that addon development takes place is by using a clunky installation process that requires a zip or a repo to see if code works in a live production environment.

This slow.

I cannot find much of anything as to how test driven development can used addon development.
Are any of the kodi classes available outside of its architecture for unit testing?

What is the most efficient way to go from dev to prod when it comes to your development workflow?

Thanks!
Reply
#2
I guess every addon dev has his/her own workflow. For me it works quite well to have my development projects directly sitting in Kodis addon folder. So I change the code, start Kodi and can instantly test the changes. No need to install the addon first. Depending on the addon type you don't even need to restart Kodi to have your code changes available.

As for unit testing you can use @Roman_V_MKodistubs. Not sure if this is the official url, but this is where I found them. You can reference them as library or simply copy the files into your project. For my projects I made some slight modifications to implement some methods and return addon settings or file lists and not only empty strings.
Reply
#3
(2018-03-16, 04:42)bvS4ziKjRf Wrote: I ask because the only way (so far as I can tell) that addon development takes place is by using a clunky installation process that requires a zip or a repo to see if code works in a live production environment.

Yes, to try an addon "in vivo" you need to install it first from a ZIP. Previously, "drop in" installation was supported when you could simply copy your addon into addons folder and Kodi picked it up, but this is not supported any more. After that you can modify code in place or copy modified files over or create symlink(s) to outside folder(s). As it was said above, in certain cases you may need to restart Kodi to apply your changes, but in most cases you just need to run your addon again.

Personally, I use PyCharm IDE with Kodistubs (link was provided above) in my virtual environment. Those are stubs for Kodi API classes that provide code completion, quick help and some code inspection (PyCharm can warn about incorrect function/method signatures and such).
For debugging code in place I use Web-PDB. I created it myself because I wasn't satisfied with existing debugging solutions for Kodi.
(2018-03-16, 04:42)bvS4ziKjRf Wrote: I cannot find much of anything as to how test driven development can used addon development.
Are any of the kodi classes available outside of its architecture for unit testing?

Alas. The only solution for testing outside Kodi is to provide mocks for Kodi API but this is not very efficient because you may end up testing how good are your mocks instead of actually testing your code. If possible, you should separate non-Kodi parts of your addon and test them with unittest or pytest, leaving the parts that interact with Kodi API for "live" testing in Kodi.
Reply
#4
(2018-03-16, 13:53)malte Wrote: @Roman_V_MKodistubs. Not sure if this is the official url, but this is where I found them.

This is the correct URL. It is not an official Kodi project and it was created a long ago by other guys, but I picked it and try to maintain within my free time and abilities.
Reply
#5
Is there a JSON-RPC command for installing an addon? The reason I ask is that one of the GSOC project proposals is for creating a Visual Studio Code extension for Kodi addons. If an addon can be installed programatically (sounds scary security-wise, now that I think of it), then maybe VS Code could be a one stop IDE for development. There could be a command to zip up the extension and install before beginning a debug session.
Reply
#6
I personally use a mix of pyCharm with Kodistubs and notepad++; I run Kodi in a portable mode and directly edit the code located in the addons folder. For testing I just load Kodi and execute script... no need to move/install files... Note this is a dedicated development setup; but i'm sure you can use "profiles" to allow a mix of "stable" and "development" usage.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#7
On a similar note, I have been wanting to write some simple addons but I am finding documentation hard to find. Most of the wiki pages seem outdated. Can anyone point me to up to date (and relatively simple) howtos?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#8
(2018-03-17, 00:21)nickr Wrote: On a similar note, I have been wanting to write some simple addons but I am finding documentation hard to find. Most of the wiki pages seem outdated. Can anyone point me to up to date (and relatively simple) howtos?
 https://kodi.wiki/view/HOW-TO_write_plugins_for_XBMC
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#9
=150%THIS PAGE IS OUTDATED: This page or section has not been updated in a long time, no longer applies, refers to features that have been replaced/removed, and/or may not be reliable. This page is only kept for historical reasons, or in case someone wants to try updating it. ImageTHIS PAGE IS DEPRECATEDThis page may still contain useful information
Use the Audio/Video plugin tutorial instead.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#10
(2018-03-17, 03:01)nickr Wrote: =150%THIS PAGE IS OUTDATED: This page or section has not been updated in a long time, no longer applies, refers to features that have been replaced/removed, and/or may not be reliable. This page is only kept for historical reasons, or in case someone wants to try updating it. ImageTHIS PAGE IS DEPRECATEDThis page may still contain useful information
Use the Audio/Video plugin tutorial instead.
I sent you a page that explains the basics. Yes its outdated; but only marginally... The wiki you found is great for copy and pasting the code; but lacks some info.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#11
(2018-03-17, 00:21)nickr Wrote: On a similar note, I have been wanting to write some simple addons but I am finding documentation hard to find. Most of the wiki pages seem outdated. Can anyone point me to up to date (and relatively simple) howtos?

Addon is a too broad definition. I maintain plugin.video.example that is a very basic video plugin with detailed comments in the code. And I'm sure I've seen an article in the Wiki about it written by somebody else (not me).
Reply
#12
Thank you both.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply

Logout Mark Read Team Forum Stats Members Help
typical workflow for addon dev0