pygame is
Simple DirectMedia Layer is
Site Swing


Building pygame.
Keeping up with developments.
Buildbots, pygame compiled on every change
Links to individual buildbot pages
Generating docs
Running tests
Code style
Writing tests.

Notes for hacking, developing, and modifying pygame.

Building pygame.

See the wiki page: Compilation to figure out how to compile pygame on different platforms.

Keeping up with developments.

Try and discuss changes on the mailing list.  Especially if you plan to do a big change, let other people know about it on the mailing list.

Most developers are not on irc all of the time - and some never.  So if you need a more realtime chat try and organise a time on the mailing list.  Email lets people communicate in their own time zones.

The svn wiki page has links to various tools... like an rss feed for changes, a web based svn browser, and also links to the build bot.  So you can read the commit logs.

Commit logs are important to keep them short, and also to summarise the changes you have made.

Buildbots, pygame compiled on every change

There is a pygame github mirror of the bitbucket, which is updated every time there is a commit to master.

The set up more buildbots issue tracks developments in the buildbots.

Links to individual buildbot pages

Generating docs


The program runs Sphinx to generate HTML docs and src/docs/{module}_doc.h C headers from reStructuredText source.

The reStructuredText .rst files are stored in the reST/source and reST/source/ref directories.

An online reStructuredText primer can be found at the Python site.

Sphinx specific markup is described in theSphinx Documentation.

The Python Sphinx package itself depends on Docutils, Jinja2, and Pygments.

For Python 2.x, installing Sphinx will also grab and install its dependencies.

Sphinx can be downloaded from PyPi or using easy-install.

For Python 3.x only the latest repository versions work.

Be sure to install Sphinx last so it does not grab the wrong dependency versions:

svn checkout
hg clone pygments
easy_install Jinja2==dev
hg clone sphinx

Running tests

Code style

Try and follow the code style of the particular file you are editing.

Use 4 spaces instead of tabs, and Pep-8 generally.  Make sure your editor doesn't insert tabs.

Try to keep things under 80 characters wide.

Try not to mix in white space commits with other code commits.  This makes reading diffs easier if you separate the whitespace updates from the actual changes.

Writing tests.

Tests are in the test/ directory.

Please see test/README.txt for more of a description on the tests, and the testing framework.

A naming convention is used for all tests. So from the name of a module, class, method, or function, you can find the tests for it.

Each module has a test file.  eg. for pygame.surface there is test/

In that file there are methods for each of the classes, functions and methods. So Surface.blit has a 'test_blit' method.  There can be multiple test methods for each method. eg. 'test_blit_keyword_args' in one of a few tests Surface.blit.  Add extra words at the end of the method name to make multiple tests for the same method.

Methods named with todo at the front "todo_blit" are methods that need to be written. Or finished. By default all of the todo tests are skipped by the test runner.  You can however, make the todo_ tests fail - to see how many more tests need to be finished.

Tests can use tags in order to organise them. There are optionally [modulename] files for each module. A test/ file is used to specify tags for the pygame.surface module. You can use tags to skip tests on different platforms, or to choose different tests to exclude or run.

There are some test related tools + code in test/util/ .

To see if anything in a module is not documented... you can use: python pygame.sprite sprite.doc

To generate some test stubs for your unittests from an existing file... you can do: python midi


our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Nov 17, 2015

Nov 12, 2015

Nov 11, 2015

Nov 8, 2015

Oct 16, 2015

Oct 9, 2015

Sep 11, 2015

Sep 6, 2015

Aug 26, 2015

Aug 25, 2015

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)