Munki's PyObjC included framework bindings

12 views
Skip to first unread message

Greg Neagle

unread,
May 5, 2022, 12:25:05 PM5/5/22
to munki-dev, 'Gregory Neagle' via munki-discuss
While working on the 5.7 Beta 2 release, I had to explicitly list all of the PyObjC modules to be installed to avoid installing one that causes problems.


There are a _lot_ of PyObjC bindings for things Munki does not need.

I looked though the Munki code, and determined only these PyObjC bindings are actually needed:

AppKit
CoreFoundation
CFNetwork
Foundation
LaunchServices
Quartz
Security
SystemConfiguration

I did an experimental build that had only these pyobjc modules in the requirements.txt:

pyobjc-core==8.5
pyobjc-framework-CFNetwork==8.5
pyobjc-framework-LaunchServices==8.5
pyobjc-framework-Quartz==8.5
pyobjc-framework-Security==8.5
pyobjc-framework-SystemConfiguration==8.5

(AppKit, CoreFoundation, and Foundation are included in “pyobjc-core”)

It built much much faster (which should not be surprising), and the resulting package is 2MB smaller (was 52MB, now 50MB, so not a _huge_ space savings). The installed Python.framework shrinks from 153M to 135M.

But this change is not without risks. Any admin that is using Munki’s python to run other Python scripts might be using PyObjC bindings that Munki itself does not need/use. If those bindings are removed, those scripts will break. 

I’m not yet sure about the benefits/risk ratio for this change, but I’m leaning towards making the change: having to build less not only makes the build faster, but also more reliable as there is less code to fail at build time.

-Greg

miq...@gmail.com

unread,
May 6, 2022, 1:26:30 AM5/6/22
to munki-discuss
I would go for a leaner munki-python as it will be more reliable.

If admins need a Python with more PyObjC modules they could use something like MacAdmins Managed Python?
I have not checked but I guess that has all PyObjC modules included in the build?

-MiqViq
Reply all
Reply to author
Forward
0 new messages