SimpleParse-pure on Python 3.2, useless, but working

I wanted to test PyOpenGL under 3.2 (using 2to3), but my entire test-suite is written in OpenGLContext, which is dependent on many other libraries (numpy, pydispatcher, pyvrml97, fonttools, ttfquery, simpleparse, etceteras).  So, since I want to test, let's see how easy it is to convert the SimpleParse-pure project (written to test pypy speed) into a Python 3.2 project.

Adding the 2to3 conversion to the setup.py didn't cause problems, but it didn't seem to work.  Turns out you must blow away your build directory to get the conversion to happen.  Okay, that's out of the way, lots of AttributeErrors on string.* functions... sigh.  SimpleParse' test suite was written a *long* time ago, and it never got updated to use string methods.  Hrm, but str.maketrans and str.translate are not precise replacements for the old string.maketrans and string.translate... okay, that's a pain, but easy to code around.  Test suite still breaks on every test; __cmp__ methods are no longer supported.  Okay, that seems to do it.

Yay, I now have a ridiculously slow parser library on Python 3.2 :) .  I'm now curious if I could run Cython over the pure-python core and produce a nice pure+optimizations package-set.  In the meantime, I really did just want to test my OpenGL code, and right now pip install numpy is failing, so the whole "test my OpenGL release under 3.2" project derailed just after this little Yak got shaved, and my half-afternoon stolen for PyOpenGL has now disappeared.

Out of curiosity, what is the currently accepted approach to advertise two different packages which provide the same API, one of which supports Python 3.x (and Python 2.x, but should not likely be used on 2.x) and one of which only supports Python 2.x (and should be preferred there)?  Do pip, easy_install etc. have support for restricting their searches to Python 3.x subsets of packages?

Comments

  1. Jean-Paul Calderone

    Jean-Paul Calderone on 09/06/2011 8:27 p.m. #

    > Out of curiosity, what is the currently accepted approach to advertise two different packages which provide the same API, one of which supports Python 3.x (and Python 2.x, but should not likely be used on 2.x) and one of which only supports Python 2.x (and should be preferred there)?

    I've often wondered this myself, but have never seen an answer.

  2. Rene Dudfield

    Rene Dudfield on 09/07/2011 5:28 a.m. #

    Hi,

    lots of packages just work on both python 2 and python 3 at the same time.

    I can't think of any packages off the top of my head that use a separate bundle for python 3 and 2.

  3. Joe

    Joe on 09/07/2011 7:37 a.m. #

    CherryPy 3.2 actually does provide separate eggs for 2.5, 2.6+ and 3, and separate win32 installers for 2.x and 3. Other packages I know of (Mako, Psycopg) appear to provide a single codebase, but I haven't been able to test them due to dependencies.

  4. Iivzymlr

    Iivzymlr on 09/11/2011 7:53 a.m. #

    What do you want to do when you've finished?

Comments are closed.

Pingbacks

Pingbacks are closed.