Native Python Implementation

I'm interested in a native Python implementation of Processing and was thinking of writing a basic prototype to see what this would entail. The pyprocessing project seems to have been dead for about five-ish years now but it does have some decent code that I would strategically recycle and port to Python 3.

I had a couple of questions:

  1. I can read Java so I'm exploring the Processing source code right now. I've browsed through some of it randomly and have also checked some really old old commits. However, given the size of the codebase, even exploring it randomly is daunting. Where (as in which file/folder) should I ideally start looking at if I want to write a proof-of-concept python implementation?
  2. Processing uses JOGL and I'm thinking of using PyOpenGL for my prototype. Since most of JOGL just wraps around the OpenGL API, translating the JOGL code to PyOpenGL code should be relatively straightforward. Does using PyOpenGL make sense? (pyprocessing uses PyOpenGL + Pyglet)

Thanks!

Comments

  • Make sure you take a look at the more recent processing.py project as a key reference. This is here:

    http://py.processing.org/ https://github.com/jdf/processing.py

    If you are looking to build a simple proof of concept I would start with the basic 2D drawing functionality -- primitive shapes (ellipse, rect, line, etc.) and color (fill, stroke, etc.)

  • I've used processing.py before and I just finished my proof-of-concept: https://github.com/abhikpal/p5py. I'm using PyGame with PyOpenGl for this (thinking of shifting to something like Pyglet). And even though the code isn't very polished, some input on this would be wonderful :)

    Also, I was wondering how "similar" should the Python port be to original Java version? For instance, using Python's keyword arguments would make functions more intuitive to use i.e., instead of something like fill(127, 0.5) one would use fill(gray=127, alpha=0.5).

  • Hi, nice prototype.

    Could we design a similar UI with Processing although p5py is using OpenGL?

  • Interesting! I think it's important to reimagine the philosophy and goals of Processing with the benefits and features of the native environment. p5.js is a good example of seeing how an API changes when moving from Processing (Java) to p5 (JavaScript).

  • Hey!

    This proposal was accepted and we just released the first alpha a couple of days ago.

    Relevant links:

    Would love to get some feedback from the community!

  • edited August 2017

    Congratulations to @theabhikpal and Processing GSOC17 on this alpha release!

    My biggest feedback would be to add a single simple Tutorial or Guide to the documentation site at http://p5.readthedocs.io/en/latest/

    Just a few paragraphs walking through how to write and run a program, with a screenshot. That would really address the project goal of being accessible to beginners!

  • @theabhikpal Kudos for your efforts. I have few comments. I was reading your post and it is not clear to me how your release relate to the previous python version. For starters, is your released a mode? Could you comment what differences are there between your released and the current mode available through the Mode manager in the Processing IDE? I see that you mention Python 3.0... are your efforts related to migration an older version of the python mode to a new version?

    I have a feeling this is a library that you run in your Python IDE. Is that correct? I am not a Python user, but I would certainly like to know more about your project.

    Kf

  • Thxs GoToLoop... It is clear now.

    Kf

  • edited August 2017

    @jeremydouglass I agree! We do need a lot of documentation and a tutorial of sorts to help people get started. I will be working on it over the next couple of weeks and porting over tutorials from the Processing website.

  • @kfrajer thanks for bringing that up. It seems to be a very common question, I think we should address this in the README in a FAQ section.

    • p5 is not a new mode for Processing. It's a Python library.
    • The Python mode for Processing is based on Jython and uses the Java version of Python internally. This kinda limits what you can do with Python as you can't use libraries form the Python ecosystem.

    Basically:

    • Python mode == Python running on top of Java Processing
    • p5 == A complete implementation in Python. No need for Java Processing.
  • Nice!1 Thxs for the explanation. You explain this in your other post where you announced the released of p5.py.... It was not 100% clear in this post and not 100% sure when I read your github repo.

    Quick question for you... do you mind explaining the differences between Python 2.7 and 3.6(?)... I have found this before when looking at Python docs but it is not clear whcih one I should be using or if it matters at all.

    Kf

  • @kfrajer,

    Yes! I should definitely update the Readme, and the like to reflect this.

    The Python wiki and the documentation do a good job desribing the differences in detail (see the wiki and the docs).

    But the main reason we made Pyhton 3 the default version was because Python 2 will reach it's end-of-life in less than three years from now [3]. I don't think p5 uses any Python 3 only features, though. So if someone is willing to take this up, they run through the entire codebase and make it Python 2/3 agnostic.

Sign In or Register to comment.