Sometimes we may have the requirement to provide applications without source code. In Java it is very easy and people are widely using also. If we want to hide our source code in python what we will do ??
I checked for several solutions for obfuscating the source code . One is using pyminifier. This is a good tool. This will rename the methods and variables. So that the obfuscated code will look more complicated. But still if you spend some time, we can read it.
Another best way to hide the source code completely is by using the built-in compiler in the python itself. This will generate a byte code and we can use that for execution.
python -OO -m py_compile <your code.py>
This will generate a .pyo file. Rename the .pyo file to .py extension. You can use this for execution. This will work just like the actual code.
NB : If your program imports modules obfuscated like this, then you have to rename them with a .pyc
suffix instead