How to launch python script for other people to run it on their machines?

86 Views Asked by At

I made a game that runs in your terminal using Python and curses. Now I want to launch it so that when people visit the repository on GitHub they can download it and play it on their own machine. I have a Dockerfile but I don't really know if it is necessary. How can other people install my game and have it running without any trouble?

Update:

I published the game with PyPI. You can have a look at it with pip install BirdJumpExtreme==0.0.1. I found this article really helpful: https://www.codementor.io/@ajayagrawal295/how-to-publish-your-own-python-package-12tbhi20tf

2

There are 2 best solutions below

7
wakey On

This is a pretty complicated question that can have a lot of possible answers. To start, I'd look into python packaging.

Here is a good guide: https://packaging.python.org/

This will help you get to a point where users can just run pip install . inside your source folder and then be able to run phils_awesome_game from the command line. Or, they could run pip install phils_awesome_game and it would download it from a repository (like https://pypi.org/).

5
heydar dasoomi On

You can create your docker image with entrypoint of excecuting python file. For example:

FROM python:3.6
WORKDIR /test
# install requirements
COPY app.py .
ENTRYPOINT python app.py

Then create the image:

docker build . -t game

Now run the game:

docker run -it game