r/learnpython • • Jan 31 '25

Best package for deploying to Github

Hi everyone,

I did a bit of Python for my data science course many years ago, so would like to continue using it over HTML/Javascript/Angular JS which I know nothing about.

I am hoping to create a text based game and deploy it on to Github. Note that I want to deploy it, not upload code for others to download and run locally. I want it accessible over a URL.

What options do I have? I heard that if I build it into Pycharm then it becomes possible? I am happy to learn a new package just for this, so would like some advice on what I should focus on learning.

Thanks!

21/08/2025 -
7 months later, I have it all figured out. Life caught up with me hence the late update. Everyone here told me it was impossible, but, well, they are wrong. I have no doubt of their technical skills, but without a genuine interest in helping those skills are meaningless. The world as they know it is confined to what they have seen before, and they refuse to entertain the possibility of things existing outside of it. Being unheard of means you haven't come across it yet, not it is impossible. As it turns out, it is relatively straightforward. I leave the answer here for posterity, in the hope that I might help some other fellow rookie programmer with a similar passion.

Learn pygame, use pygbag to compile it, then upload to Github pages. You can make much more than a text-based game and deploy it to the internet for free using this method.
https://pygame-web.github.io/wiki/pygbag/

2 Upvotes

27 comments sorted by

View all comments

26

u/danielroseman Jan 31 '25

Unfortunately this question is very confused. GitHub isn't a platform you can deploy to, it's a place for holding code repositories.

If you want someone to play your game online then you will need some kind of web server. But additionally you will need to rework your code to be a web application; you can't just run Python over the web.

-26

u/RegretSimple6826 Jan 31 '25

My friend has rewritten my Python code into HTML in the past and hosted my text based game on it. It should be possible if the only difference is language type.

I don't have the luxury of his help now, so I have to do it myself.

17

u/abcd_z Jan 31 '25

I would ask your friend what, exactly, they did, since there seems to be a conflict between what you think happened and what the posters here think the technology is capable of.

10

u/danielroseman Jan 31 '25

But that is not a thing.

Did you perhaps mean that your friend rewrote your game to JavaScript? That is a possibility. But you simply can't just run Python code "in HTML".

-1

u/abcd_z Jan 31 '25

Well, let's explore that a bit. Assuming that that is what happened (OP did mention Javascript in their original post, so it's possible), would that open the door to running it from Github somehow?

8

u/guilford Go Jan 31 '25

Yes, you will be running it on a GitHub static page as a single page javascript application. It can be self-sufficient if that is all the resource it need. Javascript can leverage all the capability of your web browser to manipulate and change content dynamically. But that would be a javascript application and not a python application.

4

u/[deleted] Jan 31 '25

[removed] — view removed comment

2

u/RubenC35 Jan 31 '25

It can be dynamic like react. Plus it is possible to run python now in the browser in some of them

0

u/Critical_Concert_689 Jan 31 '25

Not really. Github is nothing more than a large text document. You're not running or compiling anything.

5

u/Defection7478 Jan 31 '25

My friend has rewritten my Python code into HTML in the past

There's a piece of this you're missing. HTML isn't a programming language, it would be impossible to directly translate python to html. Your friend likely did what the above commenter suggested, reworking your code to be a web application.

1

u/cgoldberg Jan 31 '25

You can host static pages (html/css/js) on GitHub Pages, but not any kind of Python backend.

1

u/MiniMages Jan 31 '25

What your friend did was recreated your program in JavaScript. It is something I do as well so I can host small apps on GitHub pages.

You cannot run Python code in GitHub.

1

u/ThrustBastard Jan 31 '25

Your friend has probably used something like Flask or Web.py to make a web-app, stuck it in a docker container and hosted it somewhere like Amazon ECS

4

u/ArthurBurtonMorgan Jan 31 '25

Yep…. OP probably played his game by entering 127.0.0.1:5000 or some such in his browser and was met with the webpage presented by Flask.