Development Cycle

Posted on
Thu Feb 25, 2016 1:53 pm
cramer offline
Posts: 33
Joined: Feb 03, 2015

Development Cycle

Does anyone have any advice for the development / test/ debug cycle within Indigo. I am coming from the Vera environment and, before the introduction of theZerobrane IDE which allows code to be run/debugged directly on Vera, code development required a lot of logging code in the scripts and guesswork when errors arose. Any advice on the best practices in Indigo gratefully received.

Posted on
Fri Feb 26, 2016 12:50 am
MarcoGT offline
Posts: 1091
Joined: Sep 11, 2014
Location: Germany

Re: Development Cycle

Well,

normally the software development cycle is not strictly dependent on the platform (or tools) you use to develop it.
I am talking now at a very high level, but normally, the V-Model is followed (so, big software and so on).

But for small software/plugins/script, just start from the scratch writing down some requirements; it makes not sense to start directly with code writing as it only leads to confusion. I am following this approach right now for a Python script I would like to integrate into Indigo. I follow of course this approach also at work.
After you wrote some requirements, start with the code writing (with logging and so on, always useful) and check if those requirements are fullfilled.
Then you can start with testing or writing down other requirements.

After the SW is completed, you should test it again and then you enter in the production+maintenance phase (you will have for sure bug reporting from other users you should fix them) :D

Posted on
Sat Feb 27, 2016 5:36 pm
cramer offline
Posts: 33
Joined: Feb 03, 2015

Re: Development Cycle

Hi Marco,

I understand your points regarding the generality of software development but I am looking for advice on the specifics of developing in Indigo. Once I have a script that includes the use of Indigo objects, is the only way to test / debug by copying the script to the python default directory, executing it from within Indigo, and adding logging code to trace the script activity. From what I have read, it is not possible to run a debugger within Indigo so I am wondering if anyone has written a component that emulates the IOM methods to allow some level of testing outside of Indigo. And so on.

Posted on
Sat Feb 27, 2016 6:26 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Development Cycle

That's precisely what I do.

- I write my code outside Indigo (normally in TextWrangler, but I'm in the process of switching to PyCharm I think.)
- I open the Sample House database on a development Indigo server (on a machine separate from my production Indigo Server) to test the code.
- Make my repairs and repeat.

When working on plugins, I will open a new code window, develop and test a snippet under Python2.6 and then when I like what I have, copy it into the plugin and add the Indigo elements. Lastly, if I need to test a snippet in the IOM, I do one of two things: I either open an Indigo shell from the Plugins menu or (more commonly) I open a Python script window and run the script from there. I keep a "development schedule" for this purpose.

Dave

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Feb 29, 2016 3:05 pm
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Development Cycle

cramer wrote:
From what I have read, it is not possible to run a debugger within Indigo so I am wondering if anyone has written a component that emulates the IOM methods to allow some level of testing outside of Indigo. And so on.


That's not currently possible because Indigo scripts have to be executed by a special app which sets up the communication with the server and converts objects between native objects and Python objects. We are investigating making a Python module that would allow these scripts to be run in a normal Python interpreter and therefore use the Python debugger, but it's a non-trivial amount of work so it's probably not happening soon.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Feb 29, 2016 5:12 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Development Cycle

I tried pycharm and sublime. Both have cool things like a syntax debugger but they can not open simple files (need projects) or they can not open plugins to get to the py files
So what I am doing: use textwrangler to open file copy and paste to phycharm do typing and syntax checking and then copy and paste back to textwrangler to save
A better environment would really help.


Sent from my iPhone using Tapatalk

Posted on
Mon Feb 29, 2016 5:17 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Development Cycle

Hi Karl - I'm not sure I follow.

I right-click a plugin package and select open with PyCharm, and it makes the whole package available.


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Feb 29, 2016 10:58 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Development Cycle

Dave,

here my problem with pycharm:

when I use the browser it does not show any of the plugins:
Screen Shot 2016-02-29 at 10.53.24 PM.png
Screen Shot 2016-02-29 at 10.53.24 PM.png (50.25 KiB) Viewed 3676 times


When I click on "plugins" it opens up :
Screen Shot 2016-02-29 at 10.55.23 PM.png
Screen Shot 2016-02-29 at 10.55.23 PM.png (40.71 KiB) Viewed 3676 times
and not any of the other plugins!.

how and where do you right click?


With sublime, I cant get the python checker to load. it always shows the same error. there is some discussion on it on the web..

But I really like their layout, especially:
1. sublime cut and past column, add program sections (try.. except ..), column indent markers
2. pycharm syntax checker.


Karl

Posted on
Tue Mar 01, 2016 9:34 am
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Development Cycle

He's talking about right clicking in the Finder. From the looks of it, you have all your plugins disabled (the two that start with periods are special hidden plugins Indigo manages). Disabled plugins are in the "Plugins (Disabled)" folder.

You're not going to be particularly satisfied with the behavior if you open the plugin directly when it's in the Plugins folder because Indigo moves plugins between those two directories to enable/disable them. The way to get around that is to put the plugin somewhere else then create a symbolic link in the Plugins folder:

Code: Select all
FatMac:~ jay$ cd "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins (Disabled)"
FatMac:Plugins (Disabled) jay$ ln -s /full/path/to/your/plugin.indigoPlugin ./plugin.indigoPlugin


Then, you open your plugin in PyCharm from it's original path, in this case /full/path/to/your/plugin.indigoPlugin, then PyCharm won't be bothered when Indigo moved the plugin from Plugins to Plugins (Disabled) because Indigo will be moving the symbolic link rather than the actual plugin bundle.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Mar 01, 2016 9:43 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Development Cycle

DaveL17 wrote:
I right-click a plugin package and select open with PyCharm, and it makes the whole package available.

Likewise with Sublime Text :D

Posted on
Tue Mar 01, 2016 9:56 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Development Cycle

Jay is right, I *was* talking about right-clicking in the Finder. But my plugin files also seem to be available just fine from the PyCharm Open File menu, too.

Dave
Attachments
Screen Shot 2016-03-01 at 9.53.50 AM.png
Screen Shot 2016-03-01 at 9.53.50 AM.png (136.35 KiB) Viewed 3612 times

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Mar 01, 2016 5:38 pm
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Development Cycle

I just posted instructions on creating a PyCharm run configuration that will restart your plugin when you hit the run button.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Mar 01, 2016 6:55 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Development Cycle

Thanks Jay.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Mar 01, 2016 10:25 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Development Cycle

works now for me -- and also the restart plugin is nice.

thanks

Karl

Posted on
Mon Mar 28, 2016 4:42 pm
gazally offline
Posts: 27
Joined: Jan 18, 2016
Location: Bigfoot country

Re: Development Cycle

cramer wrote:
From what I have read, it is not possible to run a debugger within Indigo so I am wondering if anyone has written a component that emulates the IOM methods to allow some level of testing outside of Indigo. And so on.

I used to be a software developer, back in the dark ages before unit testing was a popular concept. We wasted a ridiculous amount of time, energy and money tracking down problems that a set of automated tests would have found moments after a developer hit the Save key. But now I have seen the light of unit testing and shone the light upon my code and yea! the bugs have (mostly) scurried away. And I spend a lot less time scratching my head and saying, this used to work, what happened...?

My plugins don't get enabled in Indigo until I've gotten them though a set of unit tests that cover all the behavior I want them to have and show 95% coverage, running on vanilla Python 2.6 not the IPH. I use Python's unittest and mock libraries with about 100 lines of code that pretends to be indigo.PluginBase and indigo.device. In my test code, any external dependency that is either slow or has real-world side-effects gets mocked mercilessly. If you'd like to see what I've done, go to https://github.com/gazally/indigo-omnilink/tree/master/test and take a look at indigo_mock.py and fixtures_for_test.py.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests