Jump to content
  • Advertisement
Sign in to follow this  

Packaging a Python game for end-users

This topic is 962 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there. I have a small game that I have written in Python using the Pygame library. I'm now banging my head against a wall because I am having significant trouble trying to figure out how users can install my game. I currently am using the default setuptools method of Python distribution but it always errors out when trying to downloads the Pygame dependancy. Since Pygame is not on PyPI, it has to be downloaded from its Git repo, and it will not install it.


Here is my setup.py script:

from setuptools import setup

	name = 'SpaceInvaders',
	description = 'Its space invaders...',
	packages = ['spaceinvaders'],
	package_data = {'spaceinvaders': ['data/*']},
	install_requires = ['pygame'],
	dependency_links = ['https://bitbucket.org/pygame/pygame'],

It fails to install pygame every time.


I have also tried freezing tools like py2exe and pyInstaller. However, every example I can find only deals with a single .py file. My game is a package with about 7 .py files including an __init__.py and a __main__.py. I have not been able to find any info on how to build an entire package like this into a .exe.


Any help is greatly appreciated. Thank You.

Edited by lavalamp360

Share this post

Link to post
Share on other sites

We've been using twitter's Pex to build our software so that we don't have library dependencies on our production machines. The target stills need to install the right version of Python itself (2.7, say) but you can ship all the other pieces in a single blob -- in this case including your known-good version of pygame and so on.


(They're basically zip archives with a header on them that starts a python interpretation -- when you try and import stuff, it'll look in the zip first before looking on the system.)


Pex itself is being ropey and a pain at the moment with 2.7[1], but the PantsBuild project will compile PEX objects for you (and is also a much nicer way of expressing all the dependencies; it's based on Google's BUILD file system). PantsBuild will boot itself with relatively little work.



(It IS possible to build cross-platform PEXes which will run on PY26 and PY27 hosts, but it's hacky)




[1] I think because the twitter devs are moving to PantsBuild.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!