py.Processing with PyCharm?

Hi.
I am using the Python mode, but would like MORE.
Being a Pyhon developer I would like to use PyCharm as my IDE of choice (and possibly execute the code from there).
Is this possible?

Welcome, nemecsek69!

Processing.py runs on Jython – a Java implementation of Python. So, this would require a custom PyCharm run/debug configuration and the command-line version of Processing.py.

This is how I managed to get it working:

  1. Download the command line version of Processing.py for your platform: https://py.processing.org/tutorials/command-line

  2. Extract the contents wherever you wish (this could even be your working project directory)

  3. In PyCharm, create a new project (a new environment or existing Python interpreter will work fine) and select Run > Edit Configurations

  4. Click the + to create a new configuration; leave the Script path field empty (just ignore the warning); in the Parameters field enter:
    -c "import os; os.system('path_to\processing-py.bat script_name.pyde')"

The processing-py.bat is the location of the .bat file in your extracted download location. For Linux/Mac, this would be an .sh or .app file.
The script_name.pyde is the filename of the Processing script you’re writing.

You can now run scripts using Run > Run your_config_name.

For error and console output, look for the .err.txt and .out.txt files alongside your .pyde file. I usually monitor these using a separate terminal window(s), using a tail -f command.

4 Likes

Thank you, @tabreturn. Your solution is very straightforward, I didn’t think about it.
At the moment nothing works, I saw only now that I need JRE 8u202 :frowning:
But I am positive.

2 Likes

You may also be interested in p5py – it is limited and in early development compared to Python mode, but runs native python3.

1 Like

Hello
I’ve written a full guide on how to use PyCharm with Processing and with near full IntelliSense support for all the builtin functions. if anyone is interested it is on GitHub Here

5 Likes

Thank you so much for sharing this! Also, very helpful documentation.

Only if you were interested, I wonder if this could be rolled into the processing.py official release somehow…? I’m not sure if / how you modified the processing-py.jar – if you didn’t, then I could imagine the .pyi / instructions / example being bundled with the library. Assuming jdf liked the idea, of course. @villares might have some thoughts.

1 Like

I absolutly don’t mind. and actually i didn’t modify processing-py.jar i only included it for ease of setup. i only created the stub file “lib/Processing3.pyi”. the guide i wrote was designed to try to fully integrate Processing.py with PyCharm but in reality if someone is only intrested in the intellisense part, the only thing they need to do is to place “Processing3.pyi” file at the root of thier project and then import it using my statemant “if False import…etc” and then run the sketch as normal using the terminal “java -jar processing-py.jar sketch.py”.

1 Like

Continued in full post here:

1 Like