Hacker News new | past | comments | ask | show | jobs | submit login

pyinstaller is kinda dumb here because it doesn't cache the extracted files; it extracts all of them (which is especially slow on Windows), runs the application from that temporary directory, then deletes it.

At work I've built a simple cross-platform packaging system which avoids issues like this and also separates library components from the main application (the former is rarely changed, the latter is frequently changed). Despite the entire application being around ~25 MB, it starts in around 30-50 ms from a network share on Linux and 1-2 seconds on Windows. On Linux it's just a bash script eventually calling a system-provided python 3 interpreter, on Windows there's a C# .exe which does roughly the same but the package also includes a Python interpreter (which is just the official "Python for embedding into applications" ZIP) which the C# process loads via P/Invoke. The entire thing is less than 1000 lines of Python/bash/C# and works with every package under the sun and apart from the C# stubs, which basically never change, it's supremely easy to "cross compile" because compilation in this system is combining the wheels of all dependencies into a single zip, which also makes builds completely reproducible.




then deletes it

Is that built into python or does the developer call that cleanup? I ask because I recently switched from youtube-dl to yt-dlp on a windows machine and it left multiple temporary directories full of .py files to be cleaned up by other tools. I did cntrl+c out of it at least once. Perhaps I interrupted the cleanup routine? Is the cleanup routine expected to trap kill signals or is that on the developer?


The cleanup code is part of the stub/bootloader, so depending on how the process dies it doesn't run.



- Does not work for native dependencies.

- Does not allow splitting the application up into stable/unstable parts to reduce update sizes.

- Does not directly allow multiple entry points.

- Requires Python to be already installed, or requires bundling Python loosely, which is very slow when used from a network share.

- Uses zipimport under the hood, which is very slow on network shares, and very very very slow on Windows network shares.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: