{"id":6431,"library":"pyobjc-framework-compositorservices","title":"PyObjC CompositorServices Framework","description":"This library provides Python bindings for the macOS CompositorServices framework, enabling interaction with its Objective-C APIs. CompositorServices is a highly specialized framework used for building custom rendering pipelines for displays connected to Apple silicon. This specific binding is part of the larger PyObjC project, currently at version 12.1, which maintains a regular release cadence with updates corresponding to macOS SDK changes and Python version support.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","objective-c","framework","pyobjc","compositor"],"install":[{"cmd":"pip install pyobjc-framework-compositorservices","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"This is a framework binding that relies on the core PyObjC bridge for Objective-C interaction.","package":"pyobjc-core"}],"imports":[{"note":"Classes within the CompositorServices framework are typically prefixed with 'CS'.","symbol":"CSDisplay","correct":"from CompositorServices import CSDisplay"}],"quickstart":{"code":"import objc\nfrom Foundation import NSObject, NSBundle\n\n# CompositorServices is a highly specialized framework.\n# A simple 'Hello World' for it is not practical without\n# deep knowledge of macOS graphics programming.\n# This example demonstrates basic PyObjC class instantiation.\n\nclass MyPyObjCClass(NSObject):\n    def init(self):\n        self = super().init()\n        if self is None:\n            return None\n        print(\"MyPyObjCClass instance initialized!\")\n        return self\n\n    @objc.python_method\n    def say_hello(self):\n        print(\"Hello from PyObjC!\")\n\nif __name__ == \"__main__\":\n    # Instantiate a basic PyObjC object\n    obj = MyPyObjCClass.alloc().init()\n    obj.say_hello()\n\n    # For CompositorServices, you would import and use specific classes like:\n    # from CompositorServices import CSDisplayManager\n    # manager = CSDisplayManager.sharedManager()\n    # ... and interact with its methods according to Apple's documentation.","lang":"python","description":"Due to the highly specialized nature of the CompositorServices framework, a simple 'Hello World' directly using its APIs is not practical. This quickstart demonstrates basic PyObjC object creation and method calling using the general Foundation framework. To use CompositorServices, you would import its specific classes (e.g., `CSDisplayManager`) and interact with them according to Apple's CompositorServices documentation for macOS."},"warnings":[{"fix":"Upgrade your Python interpreter to 3.10 or newer.","message":"PyObjC 12.0 dropped support for Python 3.9. Ensure your environment uses Python 3.10 or later.","severity":"breaking","affected_versions":"12.0 and later"},{"fix":"Upgrade your Python interpreter to 3.9 or newer (for PyObjC 11.x) or 3.10+ (for PyObjC 12.x).","message":"PyObjC 11.0 dropped support for Python 3.8. Users on older PyObjC versions should be aware of this if upgrading.","severity":"breaking","affected_versions":"11.0 and later"},{"fix":"Ensure you are using PyObjC 12.0 or later and targeting a sufficiently new macOS SDK.","message":"The CompositorServices framework and its bindings were newly introduced in PyObjC 12.0, corresponding to the macOS 26 SDK (likely macOS 15+). It will not be available in older PyObjC versions or on macOS versions that do not support CompositorServices.","severity":"gotcha","affected_versions":"All versions before 12.0"},{"fix":"Review custom `init` implementations to ensure they correctly handle reference counting, especially when interacting with `alloc` and `super().init()`.","message":"PyObjC 11.1 aligned initializer method behavior with Clang's Automatic Reference Counting (ARC) documentation. This means `init` family methods now correctly model stealing a reference to `self` and returning a new one. This might subtly alter memory management behavior compared to previous versions if custom `init` methods were relying on older PyObjC semantics.","severity":"gotcha","affected_versions":"11.1 and later"},{"fix":"If implementing `__new__` in a Python subclass of an Objective-C object, ensure `__init__` is used cautiously. Consider initializing instance state within `__new__` or a dedicated setup method if you're not overriding `__new__`.","message":"Changes in PyObjC 10.3 and 10.3.1 affected the interaction between `__init__` and `__new__` for Python subclasses of Objective-C objects. While 10.3.1 partially restored support for `__init__` when a user implements `__new__`, code relying on PyObjC's default `__new__` still cannot use `__init__`.","severity":"gotcha","affected_versions":"10.3, 10.3.1"},{"fix":"If working with Python 3.13 and free-threading, consult the latest PyObjC documentation for compatibility and known issues. For stability, consider sticking to standard CPython builds without free-threading.","message":"Experimental free-threading (PEP 703) in Python 3.13 is an experimental feature and was introduced in PyObjC 11.0 with significant internal changes. PyObjC versions like 10.3 explicitly state they do not support this experimental feature, and caution should be exercised when using it with any PyObjC version.","severity":"gotcha","affected_versions":"10.3 to 11.0 (experimental), potential issues in later versions with free-threading Python"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}