Configuring Rhino v8 stubs in VS Code

Hi Team,

I’m struggling to setup the stubs for Rhino 8 in VS Code.

In VSCode, I have added the following RhinoCode stub paths to the python.analysis.extraPaths property in settings.json:

C:\Users\williamssh.rhinocode\py39-rh8\site-stubs
C:\Users\williamssh.rhinocode\py39-rh8\site-interop
C:\Users\williamssh.rhinocode\py39-rh8\site-rhinopython

For the simple code snippet below:

import rhinoscriptsyntax as RhinoScript
import Eto.drawing as drawing
RhinoScript.MessageBox(“Hello”)
padding = drawing.Padding(10)

I get the following linting issues:

image

Any help would be appreciated. Thanks.

Shane.

@dale Any thoughts on this one??

Thanks, Shane.

I don’t use VSCode, sorry.

@eirannejad - anything you know about?

@eirannejad
This is where exactly I mentioned in another thread that we need some official support and guide for setting up external editor to use RhinoCommon / rhinosyntaxscript…

A python library that can be installed with pip that help with all linting, type hint, auto-completion stuff.

@xliotx, @shanew06 - why not just use the built-in editor?

– Dale

No type hinting, no linting, limited auto-completion, no plugin system…
And most importantly, if python code freeze, I need to kill the whole Rhino process.

In a word, and sorry to say it: that editor is not so great.

If you look at all the modern editors with LSP functionalities (VS Code, Neovim, etc.) and understand how complex and how powerful they are, don’t try to beat them – join them.

I was wondering if any of the McNeel team member has ever created/maintained python project that has “2k+ lines of code, 10+ files” with that native editor.

So why not use your favorite tool and just use Rhino.Inside? No special hooks required.

– Dale

Two questions here:

  1. Is that package still maintained? (It has been in beta phase for 4 yrs, and no additional update. It locks pythonnet to v2.5.2 and the major version is v3 now, not to say major Python versions…)
  2. How to port geometries back to Rhino/Grasshopper? (I tried Hops, but HTTP API cannot port all kinds of Rhino Geometries)

@stevebaer - is this something you know about?

Hi -

That question was answered here, no?

-wim

Yes, it’s still on my list of things to do.

I have to agree that the built in editor just isn’t quite up to scratch for large scale development.
A few things I’ve noticed regarding the editor in addition to xliotx’s comments are:

  • Find and Replace doesn’t work
  • Using the help seems to be a bit worse than Rhino5
  • Step-Over only works intermittently

Just a few things over noticed over the last few weeks of using it.

Shane.

So back to the original question, does anyone know how to setup the stub files in VS Code so that the Rhino modules and functions can be correctly identified and passed within Pylint?