Can I use Pycharm as the IDE and for debugging?

Hi there, I’m very new to COMPAS and just installed it through Conda. I was wondering if I can use COMPAS with Pycharm IDE or if not what IDE do you suggest, especially for debugging?

Thanks

I’ve been using COMPAS in PyCharm. It was the first time for using both COMPAS and PyCharm - so I don’t have any comparative idea on how good this paring is. But it has worked well so far.

I have a related question in terms of the workflow:

Let’s say I have a piece of python module that is dependent on compas. And I use a grasshopper script to load this module and test it with some geometries.

Is there a way that I can code my python module in an IDE like pycharm, and at the same time trigger GH to reload the script that I am working on without restart Rhino?
(I’m sure there must be a way to do this… Please let me know if I miss anything!)

Yes you can use any IDE you prefer. I do use compas with both PyCharm and Visual Studio Code. If you are already familiar with PyCharm then go for it, otherwise I would suggest you to use Visual Studio Code or Sublime: they are more lightweight and easier to configure.

I don’t know how to do it for GH, but if you are using visual studio code and you want to run python scripts in rhino directly from the IDE, you may want to check this extension: https://marketplace.visualstudio.com/items?itemName=designtoproduction.rhinopython

1 Like

@yijiangh the designtoproduction extension for VS Code is definitely one option, but this can also be done programmatically using compas_ghpython.utilities.unload_modules. The unload_modules function takes a string as argument and it unloads all loaded python modules that start with that string.

A typical workflow would then be to add a call to that at the top of the script you’re working on, so that it gets reloaded on each execution. Let’s say you have are working on a module named foo.bar, at the very top of it, you can have:

from compas_ghpython.utilities import unload_modules
unload_modules('foo.bar')

# here the rest of your imports and code
# ..

Hope it helps!

1 Like