PyMT -to javascript-, the end.

As planned in september, i’ve explored how PyMT can be translated in javascript, using Pyjamas project. All is possible, and this translation could be possible, but i will need more than 2 week actually. It’s more like 4 month. Let’s check in details…

Pyjamas… not fully compatible Python !

Pyjamas don’t actually support :

  1. tuple construction (for x, y in tuplelist / for x, y in zip(a[::2], a[1::2]))
  2. with keyword with custom class (actively used in PyMT, gx_matrix, gx_begin…)
  3. Preprocessing. It would be very nice if we can have a way to NOT parse python, and not resolve all input. Like #ifdef / #endif in C. For example, it touch providers, we are testing if the system is linux, mac or windows to include the good input providers. But Pyjamas don’t care about if, since it’s a python translator. And then it will try to convert Windows part.)

Numpy

When the scatter widget have been rewritten, we have focusing about performance. All the math are now depend of Numpy. A fully C/Python library. For translation, we should write all the part we are using in a pure javascript library.

pyOpenGL / graphx

Same as Numpy, we are using OpenGL everywhere. pyOpenGL is performant when we are using contiguous array. That’s also why we are using Numpy when passing data to OpenGL.
But the most important is.. that all our call right now is not compatible WebGL.

As defined on the Kronos website, WebGL is based on the OpenGL ES 2.0 API. Direct rendering is not available on the OpenGL ES subset (glBegin/glEnd/glVertex…). Our entire graphx package, and all our widgets need to be rewritten.

And you know what ? We are moving to our new graphics package for the next PyMT version. But it will not resolve the issue because the new graphics package are written… in Cython, a C/Python language. Not compatible with Pyjamas so.

So after the move, the graphics library should be also completely rewritten for Javascript.

Core providers

I didn’t reach this part. The goal would be to create a Javascript platform for every providers, and implement it using JS() from Pyjamas. Not a big deal.

Conclusion

The end ? The work to do is huge. It’s possible, but not alone. So if anyone want to contribute on the Javascript translation, please contact me :)

Facebook Twitter Delicious Reddit Digg

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">