I developed a video game that is based on Pygame. Now I would like to distribute my game as simply as possible (in a way that not only developers could run it ), but I’m really having the worst time of my life trying to understand how Python packaging and distributing works, what is up to date, what should I use, etc.
For now I concentrate on Linux distribution, I didn’t event start to think about Windows (But it will come… ).
I’m totally confused with all documentations I read about :
- source distributions
- built distributions
- PEP517 518 or whatever specifications
- AppImages (this seems to be the better looking solution but I just didn’t find anything clear to help me understand how to wrap a Python app)
- The problem of low level dependencies compiling like glibc.
- setup.py or setup.cfg
There is too much coexisting things and I can’t figure out what is the logical choice to make.
My game project is structured in the following way:
It relies on a open source game engine module I created, based on Pygame, that I released as a Python package on Pypi: fantomatic-engine · PyPI
The engine does all the job. The actual game project just imports the engine and runs it with a variable to provide the location of the game assets.
my_game_project/ |_ my_game/ |_ __init__.py |_ __main__.py |_ data/ |_ game config and assets...
# Locally I just run the game like this # At this point everything is fine. my_game_project $ python ./my_game
__main__.py is really just the following:
from fantomatic_engine import run_game import os from pathlib import Path os.environ["EXEC_DIR"] = str(Path(__file__).parent) # This is processed by the engine to find out where is the data diretory if __name__ == "__main__": run_game()
And that’s it.
From there I’m trying to understand what should I do to just wrap this in some sort of standalone executable. I already tried a lot of thing but I always end up stuck …
I will not describe here all the things I already tried but I would really appreciate if someone could help me to find the right way of doing this.
Any help will be greatly appreciated.
Thank you very much !