gecos-lab / PZero

GNU Affero General Public License v3.0
22 stars 2 forks source link

generating executables with PyInstaller #38

Open gbene opened 1 year ago

gbene commented 1 year ago

Hi all,

I'm opening this open issue to discuss possible approaches for creating standalone executables. For now we tested pyinstaller and it works for Windows and Linux (I did not test it on a Mac).

Pyinstaller works by creating a .spec file where all of the compilation information (mode, external files and package hooks) are stored. The compilation is run using the following command:

pyinstaller pzero.spec

BE CAREFUL TO USE THE pzero.spec FILE AND NOT THE MAIN pzero.py

If you compile directly the .py file, the spec file will be overwritten and the compiled executable won't work. Maybe we should create an installer python script that runs the command to avoid this problem.

The resulting exe will be stored in the Installers directory (included in the .gitignore to avoid large files in the repository) and in the OS appropriate subfolder.

I think it can be useful (but not immediately necessary) to:

  1. Test other compilers
  2. Try to understand how github actions work and do some tests. I think they can be very useful to create an automated way to build standalone executables. I found this, based on the nuitka compiler, that can create windows, linux and mac executables: https://github.com/marketplace/actions/build-exe-from-python-script
andrea-bistacchi commented 1 year ago

Let's use GitHub actions for this.