{"id":6157,"library":"pyobjc-framework-preferencepanes","title":"PyObjC PreferencePanes Framework Bindings","description":"This library provides Python wrappers for Apple's `PreferencePanes.framework` on macOS, allowing Python applications to interact with or create System Preference panes. It's part of the larger PyObjC project, which offers Python bindings for many macOS frameworks. The current version is 12.1, with releases closely following macOS SDK updates and Python version support cycles.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","cocoa","ui","framework","preferencepanes","pyobjc"],"install":[{"cmd":"pip install pyobjc-framework-preferencepanes","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides the core bridge between Python and Objective-C, required for all PyObjC framework bindings.","package":"pyobjc-core"},{"reason":"Often implicitly required as Foundation is a base framework for many macOS APIs, including bundle management.","package":"pyobjc-framework-Foundation","optional":true}],"imports":[{"note":"The primary class for creating or interacting with Preference Panes.","symbol":"NSPreferencePane","correct":"from PreferencePanes import NSPreferencePane"}],"quickstart":{"code":"import sys\nimport platform\nfrom Foundation import NSBundle\n\n# Check macOS version as PreferencePanes.framework is deprecated\nmacos_version_tuple = tuple(map(int, platform.mac_ver()[0].split('.')))\nif macos_version_tuple >= (13, 0):\n    print(\"Warning: PreferencePanes.framework is deprecated in macOS 13+ (Ventura) and removed from the SDK in macOS 14+ (Sonoma).\")\n    print(\"This library's functionality is highly platform-dependent and may not work on recent macOS versions or with recent Xcode SDKs.\")\n    print(\"For modern macOS, consider using the Settings.framework or ServiceManagement.framework if applicable.\")\n\ntry:\n    from PreferencePanes import NSPreferencePane\n    print(f\"Successfully imported NSPreferencePane: {NSPreferencePane}\")\n\n    # Example: Trying to access a system bundle to demonstrate framework interaction\n    # Note: Creating a functional preference pane requires more complex setup (e.g., bundle structure, Info.plist)\n    bundle = NSBundle.mainBundle()\n    print(f\"Main application bundle ID: {bundle.bundleIdentifier()}\")\n\nexcept ImportError:\n    print(\"Failed to import PreferencePanes. This usually means the framework is not available on your macOS version or SDK.\")\n    print(\"Ensure you are running on macOS 12 (Monterey) or earlier for full PreferencePanes functionality, or have an older SDK installed.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"This quickstart attempts to import the main class from the `PreferencePanes` framework. It includes a critical warning about the framework's deprecation by Apple, which impacts its usability on modern macOS versions. It then demonstrates basic interaction by getting the main application bundle ID, a common pattern in macOS development."},"warnings":[{"fix":"Target older macOS versions or consider migrating to modern Apple APIs for system settings interaction.","message":"Apple officially deprecated `PreferencePanes.framework` in macOS 13 (Ventura) and removed it from the SDK in macOS 14 (Sonoma). This PyObjC binding will likely not function correctly or be buildable on recent macOS versions or with modern Xcode SDKs. Consider alternative frameworks like `Settings.framework` (macOS 13+) or `ServiceManagement.framework` for modern macOS system settings interaction.","severity":"breaking","affected_versions":"macOS 13+ (runtime), macOS 14+ (SDK/build)"},{"fix":"Upgrade Python to 3.10 or newer for PyObjC 12.x, or to 3.9 or newer for PyObjC 11.x.","message":"PyObjC 12.0 dropped support for Python 3.9. PyObjC 11.0 dropped support for Python 3.8. Ensure your Python version meets the `pyobjc-core` requirements for the installed PyObjC version.","severity":"breaking","affected_versions":"11.0+"},{"fix":"Review Python subclass `__init__` and `__new__` implementations, especially if migrating from older PyObjC versions. Refer to PyObjC 10.3.1 release notes for details.","message":"Changes in PyObjC 10.3 affected how `__init__` and `__new__` work for Python subclasses of Objective-C classes. While partially fixed in 10.3.1 for user-implemented `__new__`, code relying on PyObjC's provided `__new__` might still not be able to use `__init__`.","severity":"gotcha","affected_versions":"10.3 - 10.3.1"},{"fix":"Review code that interacts with Objective-C initializer methods, particularly if manual reference counting or unusual object lifecycle management is involved.","message":"PyObjC 11.1 aligned its behavior with Clang's ARC documentation for initializer methods (those in the 'init' family). This means PyObjC now correctly models that 'init' methods steal a reference to `self` and return a new reference, potentially changing reference counting behavior for existing code that relied on the prior model.","severity":"gotcha","affected_versions":"11.1+"},{"fix":"Avoid using PyObjC with Python 3.13's experimental free-threading feature enabled. Monitor PyObjC releases for full free-threading compatibility.","message":"PyObjC does not fully support the experimental free-threading (PEP 703) introduced in Python 3.13. While experimental support was added in PyObjC 11.0, using PyObjC in a free-threaded Python environment might lead to unexpected behavior.","severity":"gotcha","affected_versions":"10.3+, Python 3.13+"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}