How to hide python code files and other related files in a kivy project
I recently released an Android app written in Python/Kivy on Google Play. Typically, a “build.py” script packages the entire project file into a single folder, the application package folder. However, if I look at the contents of this package on my phone after installing the apk, I can find the “android.txt” files, i.e. “.kv/.kv~” files and “.py~”* and *“pyo” files.
My question is: are open source files safe, or am I missing something when compiling the project? What annoys me even more is that the temporary files *.kv~ and .py~ expose the source code of the entire project. *
But I should mention my gratitude and respect for the Kivy project and the Kivy team. Their efforts have enabled me to build and publish a beautiful Android app in Python that I am very proud of. Many thanks to the Kivy team.
I have recently published an Android application on Google Play written in Python/Kivy
Congratulations. What is the app?
My question is: is this safe to expose the source code files or is there something that i am missing in the compilation of my project ? What is annoying me more are the temporary files .kv~ and .py~ that are exposing the whole project source code.
As TwilightSun explains, some of these files are editor backups, and you can remove or exclude them from the apk by modifying the buildozer.spec file or the equivalent python-for-android command if you use it directly.
But, more generally, if you really want to obfuscate your code, you will need to take further action. I’m not an expert, but this could include moving your KV code to a python file (using
Builder.load_string) and compiling your entire project with cython. The resulting binary will be more difficult to decompile than the python .pyo bytecode included by default.