{"id":6116,"library":"pyobjc-framework-installerplugins","title":"PyObjC Framework InstallerPlugins","description":"PyObjC is a bridge between Python and Objective-C, enabling Python scripts to interact with macOS frameworks and Cocoa libraries. The `pyobjc-framework-installerplugins` package provides Python wrappers specifically for the InstallerPlugins framework, which allows developers to extend the macOS installation process with custom steps and UI. The current version is 12.1, and PyObjC generally follows a release cadence tied to macOS SDK updates and Python version support, with major versions often introducing significant changes or dropping older Python support.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","objective-c","gui","framework","installer","plugin"],"install":[{"cmd":"pip install pyobjc-framework-installerplugins","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"The core PyObjC bridge is required for all framework wrappers.","package":"pyobjc-core","optional":false}],"imports":[{"note":"Imports the InstallerPlugins framework classes and functions directly.","symbol":"InstallerPlugins","correct":"import InstallerPlugins"},{"note":"Commonly used base class for Objective-C objects, part of the core Foundation framework.","symbol":"NSObject","correct":"from Foundation import NSObject"},{"note":"Provides core PyObjC bridging utilities, decorators, and functions.","symbol":"objc","correct":"import objc"}],"quickstart":{"code":"from Foundation import NSObject\nimport objc\nimport InstallerPlugins\n\nclass MyCustomInstallerSection(NSObject):\n    # The 'alloc().init()' pattern is standard for Objective-C object creation.\n    # Python methods often use trailing underscores for Objective-C selector arguments.\n    \n    # Example: Defining a method that an Installer Plugin might call.\n    # In a real plugin, you would override specific methods like 'initWithSection_'.\n    @objc.python_method\n    def myPluginMethod_(self, installerSection):\n        print(f\"My custom installer plugin method called by: {installerSection}\")\n        # You'd typically interact with installerSection here\n        return True\n\n# This simple script demonstrates importing the framework and defining a class.\n# A real Installer Plugin requires specific project structure and bundling\n# (e.g., using py2app) to be loaded by the macOS Installer.app.\nif __name__ == '__main__':\n    print(\"InstallerPlugins framework imported successfully.\")\n    # Instantiate the class (though it won't be 'used' without Installer.app)\n    plugin_instance = MyCustomInstallerSection.alloc().init()\n    print(f\"Instance created: {plugin_instance}\")\n    # Demonstrate calling a custom method (for illustrative purposes)\n    # In practice, the macOS Installer would call specific methods on your plugin.\n    # Replace 'None' with a mock InstallerSection object if testing interaction.\n    plugin_instance.myPluginMethod_(None)\n","lang":"python","description":"This quickstart demonstrates how to import the `InstallerPlugins` framework and define a basic Objective-C compatible class in Python. Actual usage as an Installer Plugin requires a specific project structure, Objective-C class definition patterns, and bundling into a `.bundle` within an installer package, typically managed with tools like `py2app` and proper `InstallerSections.plist` configuration. This example focuses on the Python-side import and class definition."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or a later supported version. PyObjC v11.0 similarly dropped Python 3.8 support.","message":"PyObjC v12.0 dropped support for Python 3.9. Projects must upgrade to Python 3.10 or newer.","severity":"breaking","affected_versions":">=12.0"},{"fix":"Review custom initializer methods in Python subclasses of Objective-C objects, especially those interacting with `alloc` and `init` patterns, to ensure correct reference handling under the updated ARC model.","message":"In PyObjC v11.1, the behavior for Objective-C initializer methods ('init' family) was aligned with `clang`'s Automatic Reference Counting (ARC) documentation. PyObjC now correctly models that these methods steal a reference to `self` and return a new reference, which might change memory management expectations for custom initializers.","severity":"breaking","affected_versions":">=11.1"},{"fix":"Avoid using free-threading Python 3.13+ with PyObjC unless explicitly requiring and thoroughly testing the experimental support. If issues arise, use a standard Python interpreter.","message":"PyObjC 10.3 did not support Python 3.13's experimental free-threading (PEP 703). While PyObjC 11.0 introduced *experimental* support, developers should be cautious and test thoroughly when using PyObjC with free-threading Python interpreters, as the bridge's internal C API usage may still have edge cases.","severity":"gotcha","affected_versions":"10.3 (no support), 11.0+ (experimental support)"},{"fix":"If implementing `__new__` in a PyObjC-bridged class, be aware of how it interacts with Objective-C's `alloc` and `init` patterns. For most cases, rely on the behavior re-introduced in 10.3.1, but complex scenarios might require explicit `objc.pyobjc_id` usage.","message":"There was a temporary change in PyObjC v10.3 where `__init__` could not be used when a class or its superclasses had a user-implemented `__new__`. This was largely reverted in v10.3.1 to support popular projects, but understanding the interaction between `__new__` and Objective-C's two-phase instantiation (`alloc`/`init`) is crucial.","severity":"gotcha","affected_versions":"10.3, 10.3.1"},{"fix":"Always check PyObjC release notes for deprecation or removal of bindings for specific macOS frameworks, especially when upgrading major PyObjC versions or targeting newer macOS versions. Plan to refactor code relying on removed frameworks.","message":"PyObjC v10.0 removed the `IMServicePlugIn` bindings entirely, as the framework was deprecated in macOS 10.13 and removed in macOS 14. While this specific package is `InstallerPlugins`, it demonstrates a pattern where bindings for deprecated macOS frameworks are removed in major PyObjC versions without backward compatibility.","severity":"breaking","affected_versions":">=10.0 (for IMServicePlugIn)"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}