What Python IDEs & practices are you using?

Posted on
Mon Jan 14, 2013 11:02 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: What Python IDEs & practices are you using?

matt (support) wrote:
...I'm not yet using snippets.
:o

Well, in that case maybe I can get the ball rolling. This is my first attempt at a snippet. It enters a log statement
indigo.server.log(u'text: %s' % (var), type="plugin_name", isError=True)
at the insertion point. Tabbing across you can enter the text, var name, plugin name and then delete (press delete) or edit (TAB) the isError tag. The insertion point is left after the first %s.

Save this as ~/Library/Application Support/Sublime Text 2/Packages/Python/Indigo log debug.sublime-snippet

You can then call it by typing ild<TAB> in any Python code file.

Code: Select all
<snippet>
    <content><![CDATA[indigo.server.log(u'${1:text}: %s$0' % (${2:var}), type="${3:plugin_name}"${4:, isError=${5:True}})]]></content>
    <tabTrigger>ild</tabTrigger>
    <scope>source.python</scope>
    <description>Indigo: logDebug</description>
</snippet>

Posted on
Thu Jan 17, 2013 10:35 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: What Python IDEs & practices are you using?

matt (support) wrote:
...Sublime... ...has a good Lint plugin available which catches/highlights potential coding errors.

Thanks for noting that Matt. I gave the lint checker a try. Besides finding innumerable simple formatting errors (no space after commas, a space before ")", etc.) I found several unused variables and even some real mistakes that would have thrown runtime errors had the ever been reached (Fortunately they were in exception handlers that don't get used unless something is really wrong).

Posted on
Thu Jan 17, 2013 11:05 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: What Python IDEs & practices are you using?

Yeah, the linters are great for finding problems -- I found some as well in exception handling code that is rarely exercised. Note you can edit the linter package settings to ignore warnings. Here are some I don't care about:

Code: Select all
   "pep8_ignore":
   [
       "E501", "E223", "E231", "E261", "E302", "E701", "W191", "W391"
   ]


And thanks for the snippet example. I definitely need to play around with them some.

Image

Posted on
Fri Jan 18, 2013 1:41 am
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: What Python IDEs & practices are you using?

roussell wrote:
Thanks, keep 'em coming. NSheldon, what do you use?

Hey Terry.

Sorry I missed this thread until now.

I'm no pro developer or Python power user, so I just stick to Xcode (I'm at version 4.5.2). It's more of just a text editor with usable syntax highlighting, function indexing (I guess that's what you call it), and auto-complete. I work on an older Mac Pro and mount the main Macintosh HD from the Mac mini running Indigo server on my Mac Pro via AppleShare. I keep the Indigo client running on the Mac Pro so I can reload plugins as I work on the code. A convenient (though annoying at first) feature of Xcode is it's built-in versioning and backup process. A simple (sometimes too simple) 2-finter swipe from left to right with a Mighty Mouse or Magic Trackpad and you revert to the last saved version of a document.

But, as I said, I'm no professional coder, just a hobbyist, so I don't spend all day looking at code and don't have to deal with IDE quirkiness on a regular basis. So I may be able to tolerate the issues with Xcode that you were having trouble with more easily. :-)

Posted on
Sat Jul 27, 2013 11:49 am
travisc offline
User avatar
Posts: 346
Joined: Sep 07, 2010
Location: Toronto, Canada

Re: What Python IDEs & practices are you using?

I'm really late to this thread but wanted to say +1 for Sublime Text. I'd been using BBEdit until now. I started playing with Sublime yesterday after asking berkinet what he was using. I'm hooked. I've got the SublimeLinter and SublimeRope packages installed. Simply awesome.

I love the idea of that script to restart a plugin using a keystroke from within Sublime.

Thanks

Posted on
Sat Jul 27, 2013 12:58 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: What Python IDEs & practices are you using?

I adapted the restart script to work in BBEdit as well - if any's interested I can send it out.

I guess I'm just not hardcore enough but I couldn't get into Sublime - too much like my (very) old unix admin days.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jul 27, 2013 1:20 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: What Python IDEs & practices are you using?

jay (support) wrote:
... I couldn't get into Sublime - too much like my (very) old unix admin days.

Maybe that's why I liked it :wink: (My first editor was ed. When vi came along I thought we'd reached perfection.)

One thing I really like about Sublime is the ability to have multiple cursors and make multiple changes at once.

Posted on
Wed Sep 25, 2013 11:11 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: What Python IDEs & practices are you using?

Reviving a bit of an old thread here, but JetBrains has just released PyCharm 3.0 which is their Python IDE. The most interesting part is there is now a free community edition. I love PyCharm, and while I don't (yet) use it for plugin development, I'll likely switch to it when I have time. I currently use it for Django development (our website) and it's amazing. I think the Xcode team could learn a thing or two from these guys...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Dec 25, 2013 3:14 am
SgtBilko offline
Posts: 45
Joined: Dec 02, 2013

Re: What Python IDEs & practices are you using?

matt (support) wrote:
I do like PyCharm, but as Ben mentioned it cannot debug into an Indigo plugin (or script) because the plugin's python has to run within the Indigo Plugin Host framework with provides the Indigo Object Model / APIs (and connectivity to the Indigo Server).


I appreciate i am showing my lack of knowledge but is it simply not possible to enable Indigo debugging in a 3rd party IDE ?

I have a reasonably complicated Python heating algorithm, which is producing the occasional surprising result. I would really like to debug it line by line.


Ian

Posted on
Thu Dec 26, 2013 11:33 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: What Python IDEs & practices are you using?

It might be possible, but I haven't explored what would be involved yet. Plugins are wrapped around a special process (Indigo Plugin Host) that provides all of the python hooks while also handling the 2-way communication to the Indigo Server and exposing all of the Indigo object model. That is, the python being executed is special. ;-)

Image

Posted on
Sun Apr 19, 2015 7:21 am
Chameleon offline
Posts: 611
Joined: Oct 04, 2014

Re: What Python IDEs & practices are you using?

I've got to agree with Jay here. PyCharm 3 is a great IDE and you can also download the Education Edition that contains a short course on learning Python that got me up and started. It's definitely worth looking at. It is a pity that you can't debug in the IDE but I've used non-indigo code initially, to get the logic right, and then added the indigo bit later. Of course that doesn't help a lot with debugging plugins but I still tend to develop code in the IDE to check logic and once I'm happy with that I'll port it over to indigo and work from there.

Posted on
Sat Feb 20, 2016 11:28 am
gsbrewer offline
Posts: 28
Joined: Jan 22, 2016
Location: Livermore, CA

Re: What Python IDEs & practices are you using?

I'm using Pycharm while developing a server plugin... everything works fins, but Pycharm red-flags my "import indigo" statement (no module named indigo)... does anyone know how to get it to recognize the indigo path so that it can properly sanity-check my references to the IOM? Other than that, my very complex server module works fine and all the references to indigo.everything work great. Not recognizing "indigo" in the IDE is a nuisance and nothing more.

Posted on
Sat Feb 20, 2016 4:04 pm
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: What Python IDEs & practices are you using?

gsbrewer wrote:
I'm using Pycharm while developing a server plugin... everything works fins, but Pycharm red-flags my "import indigo" statement (no module named indigo)... does anyone know how to get it to recognize the indigo path so that it can properly sanity-check my references to the IOM? Other than that, my very complex server module works fine and all the references to indigo.everything work great. Not recognizing "indigo" in the IDE is a nuisance and nothing more.

The easiest way to address this should be to delete 'import indigo" from your plugin. Indigo is imported automatically by the plugin's host process and the expressed import shouldn't be required.

Dave

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

[My Plugins] - [My Forums]

Posted on
Sat Feb 20, 2016 7:51 pm
gsbrewer offline
Posts: 28
Joined: Jan 22, 2016
Location: Livermore, CA

Re: What Python IDEs & practices are you using?

Thank you for responding Dave. Understood, but my problem isn't that I can't use the indigo expressions in my code (that works fine if I type in everything correctly), its a problem with the IDE not knowing where the indigo expressions are defined. The IOM definitions are not in my source base nor are they in standard Python locations, therefore I can't get reference context assistance and spelling checking while I am typing in code within the IDE. My server plugin currently stands at about 7000 lines of tight Python code spanning over 30 source files, Pycharm has been crucial in avoiding grammatical errors while editing (it saves a lot of time). I poked around in the "/Library/Application\ Support/Perceptive\ Automation/Indigo\ 6" folder (granted, only for about 30 minutes), but have been unable to find the IOM definitions. I am trying to avoid going into the shell and doing a global search, so I thought I'd ask you guys :-)

Posted on
Sun Feb 21, 2016 7:15 am
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: What Python IDEs & practices are you using?

Okay, I've got it now. I'm not sure that anyone has found a way to do that directly, but I could be wrong about that.

Your post did get me to go ahead and try PyCharm, and so far I'm pretty happy with it (I'm used to using TextWrangler)--but I'm only just getting started.

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

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 4 guests