Kodi Community Forum
Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs (/showthread.php?tid=173780)

Pages: 1 2 3 4


RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - Roman_V_M - 2020-06-13

I have created matrix branch that contains Kodistubs generated from Kodi master branch (future 19 "Matrix") using the updated generator script. The stub files are fully Python 3 compatible including function/method signatures with type annotations.
Note that this is a very early version that has had only minimal post-editing to fix obvious syntax errors in the code so docstrings formatting may be weird at many places. The new Kodistubs can be installed using pip:
pip install git+https://github.com/romanvm/Kodistubs.git@matrix

Now you can finaly develop your addons in Python 3 virtual environment.


RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - Roman_V_M - 2020-12-21

I have finally released Kodistubs v.19.0 based on the current Kodi "Matrix" beta: https://pypi.org/project/Kodistubs/ Now you can install "Matrix" version directly from PyPI.


RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - BillBrowne - 2022-04-17

You can use Kodistubs with Intellij IDEA.

In order for it to work you need to add the location of the libraries, given when it is installed, eg:

...kodistubs in <installation_dir>\lib\site-packages

To Project Settings -> Modules.

After setting up your project:
  • type <CTRL><ALT><SHIFT>S
  • select: Project Settings -> Modules
  • Click on the + next to Add Content Root
  • Select the directory given when kodistubs was installed (e.g: <installation_dir>\lib\site-packages)



RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - Roman_V_M - 2022-04-17

(2022-04-17, 05:06)BillBrowne Wrote: You can use Kodistubs with Intellij IDEA.

In order for it to work you need to add the location of the libraries, given when it is installed, eg:

...kodistubs in <installation_dir>\lib\site-packages

To Project Settings -> Modules.

After setting up your project:
  • type <CTRL><ALT><SHIFT>S
  • select: Project Settings -> Modules
  • Click on the + next to Add Content Root
  • Select the directory given when kodistubs was installed (e.g: <installation_dir>\lib\site-packages)

Or just pip install Kodistubs into your project's virtual environment.


RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - BillBrowne - 2022-04-18

Hi,

I tried that - maybe I was doing the wrong thing - but it didn't work.  The environment was created but it did not pick up the kodistubs stuff.

I tried it a few times, following the instructions on the Intellij website but I could not get it to work until I stumbled across the setting I showed.

But it's very feasible that I don't know what I'm doing!

Maybe this will help someone in the future anyway.


RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - Roman_V_M - 2023-01-20

Following Kodi 20.0 release Kodistubs v 20.0.0 have been released to PyPI.


RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - BillBrowne - 2023-07-15

Hi,
I'm using KodiStubs version 20.0.1

If I use a construction such as:

label = self.getFocus().getLabel()

getLabel is unresolved for class 'Control'

But when run it does return the correct label (the currently focused control is a button in this case)

I'm assuming this is because not all controls have a label.  Not sure if there is a way around this. Cheers for any help.


RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - Roman_V_M - 2023-07-15

You are correct. And as such your code is not correct and prone to errors. You should check if your Control instance returned by getFocus() actually has getLabel method. As for type checker warnings in your IDE, there's nothing you can do, except for putting some pragmas to silence them.


RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - BillBrowne - 2023-07-18

Thanks for your advice.  I will endeavour to clean my code up to fix this.  Cheers!


RE: Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs - Roman_V_M - 2024-04-10

Following Kodi v.21 release updated Kodistubs were published to PyPI: https://pypi.org/project/Kodistubs/