Porting Pygame 1.9 to Python 3 — wiki
The goal is to make Pygame compatible with both Python 2.x and Python 3. So far most Python 1.9.2a0 modules build and pass their unit tests in Python 3. The corresponding examples also run. A major milestone was the release of NumPy for Python 3.1 in August, 2010. Pygame surfarray and sndarray are now ported. Some issues regarding Unicode file paths are being dealt with in the fsencoding branch. This will soon be merged back into trunk.
April 14, 2009:
The build chain, config.py and setup.py, have been modified for Unix and Windows.These can run from Python 3.0 and successfully build updated modules.
At this point the following modules have been updated: base, surface, surflock, rect, color, constant. The pygame package __init__ has also been updated. The unit test framework has been reworked enough to allow the individual unit test modules to run as stand-alone programs. The rect and color modules fully pass their unit tests.
The changes to the python3 __init__.py have been merged back into the trunk. The compat.py module was also added.
The minimal requirements of getting the chimp.py and aliens.py examples running were met. The following modules were updated:
- color (color.c)
- display (display.c)
- event (event.c)
- font (font.c)
- gfxdraw (gfxdraw.c)
- image (image.c, imageext.c)
- key (key.c)
- local (local.py)
- mixer (mixer.c)
- mixer.music (music.c)
- mouse (mouse.c)
- pygame (__init__.py)
- rect (rect.c)
- rwobject (rwobject.c)
- sprite (sprite.py)
- surface (surface.c)
- surflock (surflock.c)
- transform (transform.c)
The following unit tests were also update:
- font_test.py (trivial)
- mouse_test.py (trivial)
- time_test.py (trivial)
The following examples have been updated:
September 1, 2010
Further modules ported to Python 3.1. Though all ported modules now pass their unit tests further testing is needed.
All examples except camera, overlay, vgrade, __movie and scrap_clipboard are considered ported.
- Complete unicode file name handling (fsencoding branch), then merge back into trunk (by mid Sept/10).
- update documentation to explain Unicode in Pygame
- work out final solution for open Python 3 IOBase objects: how to check abstract types from C. (Sept. 1, 2010) Probably the most practical solution is to just do duck typing.
- _movie - deferred until module is ready for release
- scrap (does some C string stuff that makes porting difficult)
- camera - what is the status of this module?