How to share my python program online as a web app by keeping the source code in Github?

1.5k Views Asked by At

I am a beginner-level Python learner. Recently, I have made a program (Github link). Out of curiosity, I want to implement it as a web app so that anyone can easily run the program without downloading or installing anything.

I tried with Google Colaboratory. But it's not much user-friendly as the web apps. Also, in Colab, the codes are directly visible to viewers. I wish to keep the program interface simple and easy by keeping the codes hidden. Hiding code is not my aim. But I feel that it won't be a user-friendly interface if the codes and compilation process are directly visible. I think it would be better for the viewers if a Github repo can be linked to access the source code.

Which online platform can I use to do so for free? Or do there exist any dedicated platforms such that I just need to upload my python code and it will be automatically implemented as a web app?

2

There are 2 best solutions below

1
On

Use django I guess https://www.djangoproject.com/

Of course all client-side code will still be visible.

0
On

The short story is that you cannot protect it completely if you are shipping it to anybody else. However, there are certain options you want to give it your best shot:

  • Ship compiled bytecode files instead of the python files (.pyc)
  • Create executables (Using applications like PyInstaller or Py2Exe
  • Use a source code obfuscator

A combination of all 3 will be able to reasonably prevent the casual individual from looking at your code, but will never be truly protected unless you are running it behind a service.

There's a page on wiki.python.org with further info on this topic named: "How do you protect Python source code?" I'm unfortunately not able to link to it since it contains spaces. Edits with link are welcome.