6

I have running on my own Mac with the caylsto-processing library plugged in so I can run processing scripts in a notebook in a browser tab. But I am trying to be able to run this all in binder, so that I can share my processing scripts with students during class. I created a Github repository and have it linked to a binder, and the binder builds and launches, but the only kernel available is python 3.

I have read that I can include a bunch of configuration files, but I'm new to these and I don't see any examples that bring in the calysto-processing kernel, so I'm unsure on how to proceed.

Screenshot of my binder with the jupyter-notebook with a processing script - but when you click on kernels, the only kernel it shows is python: Screenshot of my binder with the jupyter-notebook with a processing script - but when you click on kernels, the only kernel it shows is python

Any help would be appreciated.

George Profenza
  • 50,687
  • 19
  • 144
  • 218

1 Answers1

3

Very good question. Ayman suggestion is good.

I've just installed calysto_processing and noticed 3 things are necessary:

  1. installing the calysto_processing package via pip,
  2. running install on the calysto_processing package.
  3. installing Processing.

First point should be easy with requirements.txt.

I'm unsure what the best option is for the second step (maybe a custom setup.py ?).

Step 3 feels the trickiest.

Installing Processing currently isn't supported with apt-get so Dockerfile might be way forward (even through mybinder recommend that only as a last resort).

Let's assume a Dockerfile would contain all the steps to manually download/install processing (and I'm not super experienced with Docker at the moment btw), it will need to be executed which will require a windowing system to render the Processing window. I don't know how well that plays with Docker, sounds like it's getting into virtual machine territory.

That being said, looking at the source code right here:

  1. Processing is used only to validate the sketch, and pull syntax errors to display them otherwise.
  2. ProcessingJS is used to actually render the processing code in a <canvas/> element within the Jupyter Notebook

I'm not sure what the easiest way to run the current calysto_processing in mybinder as is.

My pragmatic (even hacky if you will) suggestion is to:

  1. fork the project and remove the processing-java dependency (which means might loose error checking)
  2. install the cloned/tweaked version via pip/requirements.txt (pip can install a package from a github repo)

Update I have tried the above: you can run test kernel here

ProcessingJS in mybinder online shared Jupyter Notebook

The source is here and the module is installed from this fork which simply comments out the processing-java part.

In terms of the mybinder configuration it boils down to:

  • create a binder folder in the repo containing the notebook
  • add requirements.txt which points to the tweaked version of calysto_processing stripped off the processing-java dependency: git+https://github.com/orgicus/calysto_processing.git@hotfix/PJS-only-test
  • add postBuild file which runs install on the calysto_processing module: python -m calysto_processing install --user

Notes

  • With this workaround java error checking is gone
  • Although Processing syntax is used it's execute as javascript and rendered in <canvas/> using ProcessingJS: this means no processing-java libraries, no threads or other java specific features,(buggy or no 3D),etc. just basic Processing drawing sketches
  • It might be worth looking at replacing ProcessingJS with p5.js and checking out other JS notebooks ? (e.g. Observable or IJavascript)
George Profenza
  • 50,687
  • 19
  • 144
  • 218
  • 1
    This is so incredibly helpful!!!! Thank-you, George! I will try to get this going on my own binder when I have some time over the weekend. I am going to be teaching a class that uses processing, so p5, etc. aren't useful to me. – Celine Latulipe Jul 17 '19 at 17:50
  • 1
    Glad to hear it ! I'm curious about the class, if you could share your experience teaching Processing with Jupyter Notebooks that would be great ! (As I mentioned, this is limited to 2D beginner level graphics/input(mouse,keyboard), haven't tried loading images yet)). If the above answered your question feel free to tick/mark it ;) – George Profenza Jul 17 '19 at 19:26
  • 1
    It's a new class (new to me) that I will be teaching this fall at the University of Manitoba. I used to use Processing a lot, but I haven't ever taught it. I just think I can point students to Jupyter/Calysto-processing notebooks on Binder and they can work on activities in class and this way I don't have to worry about helping them get anything installed on their own laptops or tablets. – Celine Latulipe Jul 18 '19 at 21:01