January 31st, 2017

Rene Dudfield: Promoting pypi for python game releases. Part 1.

Programing, Python, by admin.
This is a statement of intent similar to what I wrote to the pygame mailing list some weeks ago. That I think the python game community should promote packaging their games as python packages. When I wrote to the mailing list, not everyone was convinced, and some people had other ideas. So I’m going incorporate their feedback, and to try to be more detailed on the full plan of where I think we should go, what benefits this provides the python community as a whole, and the benefits it provides game developers.

This is the first in a series of articles about making python game distribution better.

“ the python game community should use python packages ”

With all the great work from lots of people pygame is often easily installable via pip – the standard python packaging system. We still have some issues, but it works quite well on major platforms. See “How we cobbled together a free Spectacularly Adequate Build Page.” for more details on how we package pygame for pip.

Now our games can be installed with pip too! Here’s an example game I started packaging up, now available on the python package index. Note, it will install pygame for you.

pip3 install –pre solarwolf
solarwolf – a game I packaged up for testing

Since many people enter the python world via games, it makes sense that they get used to publishing python packages as well. I’ve sat in python user groups, and still 80% of the room has never published a python package despite many of them working with python every day – for years. Let that sink in for a bit… most python developers never publish packages.
“ newbies to python often come in through game development
Currently most people making games find packaging them up for distribution very time consuming, and also pretty much impossible to do for multiple platforms. For game libraries, people still do not use pypi so much. It’s easier for them to just put the source tarball up on a website and tell people to download it.

As a game developer why should I use pip? Firstly, there is a very large audience of people who can install python games – python developers. This is mainly your peers, but python also comes installed already on many platforms (linux, Mac, etc). You can manage dependencies more easily (so you don’t need to worry people don’t have one of your other libraries installed). You don’t need to worry about the platform issues of binaries so much. If they have pip on their platform, then they can install your game. Other benefits of publishing on pypi include syndication, since many people tweet and copy all the releases on pypi. Another benefit is all the infrastructure work that goes into pypi, CDN networks and such.

I suggest efforts should be applied to:

  • updating tutorials, and spreading the idea of publishing python games to the cheeseshop (pyweek, pygame.org tutorials, external tutorials, books, youtube videos)
  • base code for a pygame game in a standard structure (skellington, cookiecutter etc)
  • contacting other python game communities to suggest pypi should be a priority
  • making the cheeseshop/pypi itself a better platform for game publishing needs
  • making python packaging easier, by fixing python packaging warts which stop newbies.

What pypi doesn’t do currently? It doesn’t do many things that a good game release system would do. Video/youtube links, and even screenshots aren’t available. Discussion has been disabled (they found it way too hard to moderate). Even ratings are not on there (which can help for discover-ability). Another issue is that closed source things aren’t really looked apon nicely there(but it is allowed). Finally, packaging in python still isn’t the easiest thing (it’s definitely not as easily as uploading a zip file, but it is waaaaaay nicer now than ever before).

Any work that goes into making the packaging better for games helps out with other python game communities as well. We can perhaps even gain allies from the other communities to help improve things for python games in general.

Here are where the pypi projects live.

The second part of this article series is about what else we can do to improve distribution. Topics coming up in this article series include – a new “skellington” (from pyweek) based on the “sampleproject” (from pypa) with everything setup, and using appveyor/travisci/etc to build binaries on mac/linux/windows/android for everyone, as well as a list of python packaging warts I’ve gathered from people trying to package their python modules.

Back Top

Leave a Reply