fix: add conditional stripping for Linux executables#5223
Open
vaibhavxlr wants to merge 2 commits into
Open
Conversation
Collaborator
|
Thanks! Can you add a changelog entry? |
ea10e44 to
ce4f9c3
Compare
for more information, see https://pre-commit.ci
Author
Hey, it's done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This essentially fixes #2291.
I tried building the Linux executable on my machine ( Ubuntu 24.04 x86_64 desktop running Python 3.14 ) and found that executable generated was around ~12M, roughly the same size of PE and Mach-O generated by the Github Action workflow.
On analysing the executable a bit, I found the main difference was the size of Python interpreter being bundled by PyInstaller. Following is the size comparison-
On my local-
On Github Action runner-
And this is what file command returned-
On my local-
On Github Action runner-
As we can see Github Action libpython is not stripped and carries DWARF data, as compared to what gets shipped on Ubuntu systems by default. It didn't make sense to me that release builds carried debug information anyway. I looked up a bit and found that PyInstaller offered --strip, which made sense over manually stripping the libpython provided by the runner's environment.
As it is not recommended to be used on Windows and the Mac executable seemed fine, I have added the appropriate matrix based check.
I ran the workflow on my fork and these are the results-

I also did some sanity tests locally by trying to format some projects using the above x86_64 build just to be on safer side.
Checklist - did you ...
--previewstyle, following the stability policy?CHANGES.mdif necessary?