Python Programmers: What do you use?

Curious what helps you with Rhino-specific programming and which IDE you use. Coming from C# it was pretty easy to decide, but I see that there are several options for IDE’s when programming in Python. PyCharm looks like the best (for me) but doesn’t offer much advantages for Rhino to my knowledge. I really don’t like VS Code.

Other resources like favorite books, tutorials, etc… would be helpful.

Generally speaking I like PyCharm for two particular reasons: It enforces a given code-metric and it does debugging very well. However, for Rhino there is simply not a lot of benefit, because the Api violates the metric, and debugging is a bit complicated. In Rhino, I would stick to the default editor and move anything more complex in a library, if doable.
But regarding the metrics, if you work in a team it is good if you don‘t debate over code styling too much. You just ask anyone to follow the presets as much as possible, and you get a very unified code base. A good static code analyser can also help in preventing certain types of bugs.

1 Like

debugging is a bit complicated
But does it actually work? Can you recommend a tutorial or another instruction page? The longer I look around, the more confused I get.

1 Like

For Python 3, I plan on using Script Editor.

For IronPython, I’ve been using VS2015 with PTVS and Productivity Power Tools for larger projects, otherwise Rhino Python Editor.

1 Like

Here is some information that may help get oriented to the Script editor and Python. There is a guide below specifically about debugging in the editor.

Here is a Quick marketing overview of what’s new in 8: Scripting Editor and Python

Technical Guides with more detail:

  1. ScriptEditor Guides
  2. Debugging in the Script Editor Guide
  3. Rhino.Python Guides
  4. Rhino.Script with Python Guide 101

We can also help with any questions you have about these.

1 Like

There’s no Rhino extension/plugin for it? That’s a shame.

The default editor is the one that comes with Rhino? It’s the real deal I guess?

I originally started (well almost started) learning Iron Python because I stumbled across an old link. It looked really good but it’s end of service life (heard that someone is maintaining it now) and barely got much real-world use. I was a bit miffed because I spent a lot of time looking into it but noticed there was barely any resources on it compared to other stuff. Python + VS would be pretty awesome. IronPython was a .NET wrapper if I’m not mistaken? It would be worth looking into again if it ever gets revived/modernized.

@keithscadservices

You can definitely use your editor of choice outside of Rhino. An editor inside of Rhino however, provides autocompletion, debugging, and is fully aware of the Rhino and Grasshopper environments so it can make decisions (e.g. it can update your RunScript method signature when component parameters are changed). It can also build Rhino and Grasshopper plugins.

To provide these services in an external editor, a complicate language server is required that would be partially running over Rhino.

Let me know if you’d need more info about the Rhino built-in editor and I’d be happy to.

1 Like

100% going to give it a try. I’m going to create a mini-project independent of Rhino to get familiar with Python then get back to work on creating stuff for Rhino specific. Thank-you!!

5 posts were split to a new topic: Do ETO forms work in Python?

No IDE.
Just browsing API and samples in https://developer.rhino3d.com/
And using the text editor I like ( Vim ), testing/debugging the script in Rhino from a button.

But I only used to write scripts for personal use. ( I’m retired )

Vim FTW

1 Like

When I did C# components for Grasshopper I would use Visual Studio and copy/paste the code into Rhino… whether this was the intention or not… and whether I would get into trouble with more complex tasks… who knows.

I’m really liking PyCharm so far. Very cut and dry and good resources on how to use it. VS Code… I don’t know why but doing even the simplest things yields the most confusing tutorials and explanations I’ve ever seen. And it’s time intensive to set up. Autodesk/AutoCAD wants to switch to VS Code for AutoLISP development and thus far… I haven’t seen a good case to use it. The setup is convoluted and all said and done it doesn’t actually do everything the old IDE included with AutoCAD did.

It looks like McNeel is focusing on Python which is a big reason I’ve made the switch. A built-in IDE is a big advantage in my opinion: I still use the Built-in one with AutoCAD that must be at least 30 years old.

Generally, I use the Rhino Script Editor for small Python scripting projects, VIM (in iTerm 2) for medium size projects, and PyCharm Community (free) with IdeaVIM for huge projects that require more advanced IDE features.
I use VIM more and more nowadays. There’s definitely a certain learning curve to it, but once you’ve internalized certain commands important to your workflow, there’s really nothing better in terms of text editing (in my opinion). I even use it in Obsidian, which is a note taking and management application. The risk with VIM is that you grow to dislike normy text editors though, where you have to fiddle around with the mouse a bunch to get even the simplest things done. :wink:

2 Likes

Reading the rhinoscriptsyntax source code helped. I made a small tool for it, though I don’t know whether it works in Rhino 8

Reading up on C# specifics like overloaded functions helped too, so you have an advantage coming from that ecosystem

Maybe this will help. Also a favourite book for really getting the zen of Python is “Fluent Python” by Luciano Ramalho

1 Like

Awesome!! Thank-you.