Wednesday, June 14, 2006

Dear Lazyweb (re: Python packaging)

How are Python applications supposed to be packaged?

I was building a distutils setup.py for glChess. The distutils doc describes itself as:

... (use) Distutils to make Python modules and extensions easily available to a wider audience ...

However glChess is an application and not a library so does not need to make any of its code publically available. Should I make a site-packages/glchess package with all the glChess code? Then what about name spaces - I guess "glchess" is safe but other application names could collide with library packages/modules. Should I use "eggs" (can't find a lot of documentation on these). Note I have not found a Python application that installs its code with distutils (links anyone?).

Also as a side note is there simple way of including translation files in distutils? For glChess I have a directory of gettext translation files po/en.po, po/en_NZ.po etc which get built to po/en.mo, po/en_NZ.mo etc. These should then be installed into /usr/share/locale as en/LC_MESSAGES/glchess.mo and en_NZ/LC_MESSAGES/glchess.mo. Note that the .mo files have been renamed however distutils.core.setup() does not allow file renaming through the data_files argument.

2 comments:

Squirk said...

Trac is an application (albeit a Web application) that distributes using setuptools and uses eggs for plugins.

The project has pretty good documentation, too.

Can't help you on the gettext side, though...

Robert Ancell said...

I have now release glChess 0.9.5 with the code in site-packages under the "glchess" package.

The translations are not in the distutils build - they get made and copied by the Debian build process.