-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuitka stand alone executables #296
base: develop
Are you sure you want to change the base?
Conversation
build_tools/build_script.py
Outdated
rmtree(shipping_folder, ignore_errors=True) | ||
shipping_folder.parent.mkdir(parents=True, exist_ok=True) | ||
Path('__main__.dist').rename(shipping_folder) | ||
Path(f'{shipping_folder}/__main__.exe').rename(f'{shipping_folder}/ibridges.exe') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be ibridges-gui.exe? Also, for non-windows, there probably shouldn't be the .exe
suffix, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, this is why it would be nice to test this on a different OS. Unfortunately I only have headless Ubuntu machines. Also renamed the exe to 'ibridges-gui.exe'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very nice to be able to create a (fast) executable, thanks for implementing it! I currently don't have a Python/windows setup, but I can if needed test it out later.
It would be nice if the executable is built automatically with every release. That should be possible with github Actions, right?
Btw, the setup with the venv seems rather complicated, but I suppose that's how Nuitka is supposed to work? I was trying to figure it out from their documentation, but it seems a little sparse.
In general executables, or installers will make it easier for our users, enabling also people without any python knowledge to get started on their own. Nuitka is not crossplatform so you have to build the windows exe on a windows machine, ubuntu for ubuntu etc. We might be able to solve this with docker files, starting these with github actions but that's another bridge. The venv has nothing to do with Nuitka, subprocesses don't inherit the venv from the process in which they are started. |
Yes, it would be nice to build the executables every release automatically with GH actions, but I agree with you that that can wait. It looks like we're already quite close though (thanks to this PR)! I would say mac / ubuntu is a lower priority, since most users will only have to use |
@qubixes is also my preference to build the exe for all three operating systems. I already did some homework, the git actions are described in the documentation of Nuitka: github actions That is an easy setup, personally prefer to have the script to build it locally (this PR) as well so we can debug the builds and test new functionality. |
Agreed! |
It is unfortunate that when the ‘--onefile’ flag is passed to a python package the executable is first unpacked into a temporary directory before it is started. Therefore I recommend to build the executable as a folder. One big advantage of Nuitka over pyinstaller is that it compiles the python code to C where possible. In my tests on Windows this executable is 5x faster than the one build by pyinstaller. The price to pay is some compilation time, sounds like a good trade to me.
There is some weird behavior, when building the executable the first time I got the error '"irods_authentication_scheme": "irods.auth.pam_password" does not exist'.
To solve this I forced nuitka to include the entire python irods package (minus the test folder) in the build:
"--include-package=irods --nofollow-import-to=irods.test"
With this change all functionalities work. It is not clear to me why this specific import is not followed by default.
Additional changes:
The code has been tested on IOS and ubuntu but its always recommended to give it a check. The majority of my testing was done on windows in an effort to make iBirdges available on all WUR machines.