Feature request - indigo.py api file

Posted on
Tue Apr 18, 2023 2:20 pm
Jason G. offline
User avatar
Posts: 54
Joined: Mar 21, 2018

Feature request - indigo.py api file

I've been doing a bunch of things in python, got annoyed at the little squiggly line in VSCode for the 'import indigo' line... and realized I could just create my own indigo.py file to make VSCode happy. The file only exists in my dev directory, I don't copy it to the Scripts directory.

I added a few dummy classes and methods that don't actually do anything - to see if I could help VSCode with auto-completion, and it works reasonably well. Below are the handful of methods and variables that I use, an admittedly naïve version without type help, etc.

My feature request would be for a proper version of this file to be made and shipped with Indigo. Or on the website somewhere? Or heck, maybe even put it into pip so that I can just 'pip install indigo-types' or something similar, and not have to mess with copying a file.

Thanks!

Code: Select all
## indigo.py - shell to fake out VS Code and to help with auto-completion
devices = []
variables = []

class server:
    def getPlugin(id):
        return ""

    def log(msg):
        return

class dimmer:
    def setBrightness(name, value):
        return
   
class device:
    def turnOn(name):
        return
   
    def turnOff(name):
        return

class speedcontrol:
    def setSpeedIndex(name, value):
        return
   
class variable:
    def updateValue(id, value):
        return
   
    def getValue(id):
        return ""
   
class insteon:
    def sendRawExtended(address, rawMessage):
        return

Posted on
Tue Apr 18, 2023 5:36 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Feature request - indigo.py api file

What you're really looking for is an indigo.pyi file (that's a python interface file). That would be an interface file that describes the python API as we've implemented it. One of our 3rd party developers has graciously started looking into building one though I don't know the status. It's actually a very large job since our API isn't actually implemented in Python but rather is (mostly) implemented in C++ and bridged to Python (so generating an interface file directly isn't possible).

In any event, it's something we definitely would like to have for developers, but it's a large enough task that it probably will never rise enough in priority for us to do directly. We would provide any developer(s) who want to create and maintain it all the necessary information. This could become a community effort.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 21 guests