Sometimes  it is necessary to share application with someone else, and one would like to hide fragments of the code. It is very likely that it will occur on desktop applications, in which user would like to run the program offline. In Python there are some problems with it, because it is interpretable language. As it is at present  in 2018 we don’t have possibility to secure the Python source code from viewing it.

Without going in to much detail, with help of the Python you can „compile” code to the form unreadable for human. „Decompiliation” of such code is not trivial even for advanced users. In most cases, this form is fairly enough.

Compilation of all .py files in current directory :

python -m compileall .