Reduce framework size #78
Open
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.
The PR proposes slimming down final app size by (1) reducing the size of the bundled python framework and (2) only importing the essential frameworks from PyObjC.
Optimizing bundled python framework
By removing the test suite, gui frameworks and other unnecessary modules from the stdlib, we can save ~32MB. We can shave off another ~19MB by removing the cache dirs (this does mean that python needs to rebuild the cache on startup, but this should only add a few seconds the first time PlotDevice is opened).
Total change: 204.7MB → 154.0MB, a savings of 50.7MB (24.8%).
Selective PyObjC imports
By only importing what we use from PyObjC, we go from 35.1MB (full PyObjC) to 19.5MB, a savings of 15.6MB (44.4%).
After testing, this results in a final app bundle of ~115MB, down from ~172MB (~57MB or 33% saved).