Re: Porting to python 3

"Mike C. Fletcher" <[email protected]> Wed, 28 Mar 2012 09:55:48 -0400
Newsgroups gmane.comp.python.opengl.devel
Message-ID <[email protected]>
On 12-03-28 06:40 AM, Rob Reilink wrote:
> Hi,
>
> I'd like to help porting pyopengl to Python 3.
Great.
> I noticed there is already a Python 3 branch on launchpad made mainly 
> using the 2to3 tool. However, I can imagine that this branch cannot be 
> merged with the main branch since that would make pyopengl 
> incompatible with Python 2. My suggested approach would be to use the 
> 'use_2to3' flag of setuptools to make the source tree compatible with 
> both python 2 and 3 as discussed here: 
> http://packages.python.org/distribute/python3.html . The basic idea is 
> that the 2to3 conversion (possibly with custom fixers) is done at 
> build/install time.
IIRC we've already merged all of the Python 3 patches that have been 
generated, and we already have 2to3 included in the setup.
> As I understood from a colleague of mine (Almar Klein) who had 
> discussed porting to Py3 with Mike Fletcher a while ago, one of the 
> issues was that the 'testsuite' that was used for testing PyOpenGl is 
> also written in Py2 and thus needs porting before rigorous testing 
> could be performed. With the proposed approach, the source code can 
> still be tested under Py2 with the existing test suite. Until a proper 
> Py3 test suite comes available, Py3 support could be denominated as 
> 'untested'. The toolkit that we will be using PyOpenGl for (visvis, 
> http://code.google.com/p/visvis/) will be ported by us and will as 
> such be a basic test for PyOpenGL under Py3
That's basically where we are already.  That is, we have a test suite 
(OpenGLContext), which isn't likely to be ported to Python3 any time 
soon, as it depends on lots of other modules, each of which I need to 
port to Python3.  Since they tend to be very heavily optimized and 
"meta", they tend to take a lot of effort to port.  PyOpenGL should, in 
theory, work on Python 3, and it seems to from the testing that has been 
done so far.  OpenGLContext is *not* working on Python3, not so much 
because it couldn't be done, but because I haven't prioritized it, and 
I'm not likely to do so until I actually consider moving any code to 
Python3 myself (I just installed Python3 on this machine to see if 
PyOpenGL would install, it seems to, though with a warning from pip).
> I'd like to have suggestions on how to proceed in such a way that my 
> efforts can eventually be taken into the main branch, such that the 
> time spent by us (Sience Applied) will eventually be of benefit to all 
> PyOpenGL users.
I'm quite willing to accept Python 3 patches that don't introduce too 
much code-smell (there's going to be some code-smell, but I don't want 
the whole code-base rewritten with "run on both Python 2 and Python 3 
unmodified hacks").  As noted, we *should* have all of the current 
patches integrated in bzr and the latest alphas.

Basically, propose clean patches that don't negatively impact Python 2 
support and I'm very likely to accept them,
Mike

-- 
________________________________________________
   Mike C. Fletcher
   Designer, VR Plumber, Coder
   http://www.vrplumber.com
   http://blog.vrplumber.com


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net