Skip to content
Tram Ngo edited this page Apr 26, 2022 · 2 revisions

Package Python code with PyInstaller

  • Run anaconda prompt, activate the conda environment (if you haven't done that already)
  • Navigate to 'src' folder
  • Run: python -m PyInstaller pysoda/api.py --distpath pysodadist

Optional

  • Edit spec file as needed (e.g. exclude PyQt5, tkinter). Especially, adding the following may be required on Windows and MAC: hiddenimports=['pkg_resources.py2_warn']
  • To generate exe, Run: python -m PyInstaller --noconsole api.spec --distpath pysodadist
  • for electron packaging, build and pysoda folder (with the .py files) could be deleted or ignored

You can then delete the build folder and the api.spec file generated by PyInstaller before you move on since they are not necessary for packaging and distributing the app.

Note: On Windows, once the Python code is packaged, make sure the pyzmq.libs folder is included in pysodadist/api before going on with packaging the app. If not, make a copy of the pyzmq.libs folder from C:\tools\Anaconda3\envs\{environment name}\Lib\site-packages\pyzmq.libs and paste it in the pysodadist/api folder.

Package electron app

You can use the predefined build script to create a release for the app.

  • Windows:
npm run build-win
  • MAC:
npm run build-mac
  • Linux:
npm run build-linux

If there are any errors, please check your build settings in the package.json. For more information regarding the build process and all the possible configuration options please refer to electron-builder documentation.

Creating Releases

If you would like to fork this project and submit releases to your repository, please use the npm run deploy-<platform> command. You will also need to change the two repository options to point to your repository in your package.json. You will need a Github Access Token to allow electron-builder to push to GitHub or any other repository. This access token must be in your environment when you run the npm script. On Linux and MacOS, you can set this variable directly in your .bashrc or .zshrc with an export command. For windows please refer to these instructions.

Note: If you are building on macOS with the purpose of distributing outside your development machine, you must code sign your executable so that other users can open SODA. The entitlements.mac.inherit.plist file may need to be modified for this purpose depending on how Apple decides to change their runtime requirements. You are currently unable to notarize the app via Apple's authentication service since the python and electron runtime are not signed and notarized at the same time.

Overview

Developer guidelines

Using the source code

Packaging

Clone this wiki locally