{"id":6073,"library":"pyobjc-framework-avrouting","title":"PyObjC: AVRouting Framework","description":"PyObjC is a bridge between Python and Objective-C, enabling Python developers to write full-featured macOS applications and access Cocoa frameworks. The `pyobjc-framework-avrouting` package provides Python wrappers for Apple's `AVRouting` framework, which allows applications to integrate third-party devices and protocols into the system's media route picker. It is actively maintained with releases frequently aligned with new macOS SDK versions, and the current version is 12.1.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","objective-c","cocoa","framework","audio","avrouting"],"install":[{"cmd":"pip install pyobjc-framework-avrouting","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Fundamental bridge between Python and Objective-C, required for all PyObjC framework wrappers.","package":"pyobjc-core","optional":false}],"imports":[{"note":"All classes, functions, and constants from the AVRouting framework are made available under this module.","symbol":"AVRouting","correct":"import AVRouting"}],"quickstart":{"code":"import AVRouting\nimport objc\n\ndef main():\n    # Instantiate a core AVRouting class. AVCustomRoutingController manages custom device routes.\n    # Actual functionality requires deeper integration with macOS services and delegates, \n    # typically within a full Cocoa application context, as per Apple's AVRouting documentation.\n    controller = AVRouting.AVCustomRoutingController.alloc().init()\n    \n    # Example of accessing a property (if available, consult Apple's docs for specifics)\n    # This particular property needs a delegate or further setup to be meaningful.\n    # For demonstration, we just show instantiation.\n    print(f\"AVRouting.AVCustomRoutingController instance created: {controller}\")\n\n    # To make sure PyObjC is properly initialized in a non-GUI context\n    # This is often handled implicitly in Cocoa applications, but good for standalone scripts.\n    objc.autoreleasepool(lambda: main_logic())\n\ndef main_logic():\n    # Your main PyObjC logic goes here\n    pass # The example already does the print in the outer main\n\nif __name__ == '__main__':\n    main()\n","lang":"python","description":"This quickstart demonstrates how to import the `AVRouting` framework and instantiate a basic class like `AVCustomRoutingController`. Full functionality of the `AVRouting` framework typically requires integration with other macOS services, UI elements like `AVRoutePickerView`, and the implementation of delegate protocols as detailed in Apple's `AVRouting` documentation."},"warnings":[{"fix":"Upgrade to Python 3.10 or newer (Python 3.10 is the minimum for PyObjC 12.x).","message":"PyObjC 12.0 dropped support for Python 3.9.","severity":"breaking","affected_versions":"12.0 and later"},{"fix":"Upgrade to Python 3.9 or newer (Python 3.10 is the minimum for PyObjC 12.x).","message":"PyObjC 11.0 dropped support for Python 3.8.","severity":"breaking","affected_versions":"11.0 and later"},{"fix":"Run `xcode-select --install` in your terminal to install the necessary tools.","message":"Installing PyObjC from source (or in some edge cases even binary wheels) requires Apple's Xcode Command Line Tools to be installed on your macOS system.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review Python subclasses that implement both `__new__` and `__init__` if upgrading from pre-10.3.1. Consult PyObjC release notes for details.","message":"Behavior around `__init__` when `__new__` is implemented in Python subclasses of Objective-C classes changed in PyObjC 10.3 and was partially reverted in 10.3.1. This can affect custom initializers.","severity":"gotcha","affected_versions":"10.3, fixed in 10.3.1 and later"},{"fix":"Review custom Objective-C class wrappers, especially `init` methods, for potential changes in reference counting behavior.","message":"PyObjC 11.1 introduced alignment with `clang`'s Automatic Reference Counting (ARC) for initializer methods (methods in the 'init' family), which now correctly model reference stealing and returning new references. This might subtly change memory management behavior for custom Objective-C class wrappers.","severity":"gotcha","affected_versions":"11.1 and later"},{"fix":"If you relied on KVO with Python `NSProxy` subclasses, this behavior is now implicitly disabled. Re-evaluate if KVO is strictly necessary or if an alternative observation pattern can be used.","message":"Key-Value Observing (KVO) usage is automatically disabled for subclasses of `NSProxy` defined in Python to prevent `SystemError`.","severity":"gotcha","affected_versions":"12.1 and later"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}