This library provides Python wrappers for Apple's DiskArbitration framework on macOS, enabling programmatic interaction with disk management, mount/unmount events, and disk information. It is part of the larger PyObjC project, currently at version 12.1, with a release cadence often synchronized with macOS SDK updates and Python version support.
pip install pyobjc-framework-diskarbitrationVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the DiskArbitration framework and create a basic session. It verifies that the framework is correctly loaded and accessible, releasing the session immediately as a full-fledged DiskArbitration application typically involves event loops and callbacks.
Upgrade Python to 3.10 or later, or pin pyobjc-framework-diskarbitration to a compatible version (e.g., `<12.0` for Python 3.9 users, `<11.0` for Python 3.8 users).
Carefully review custom `__new__` and `__init__` implementations in Python subclasses of Objective-C objects, especially those involving memory management, to ensure they comply with the new ARC semantics.
For subclasses implementing `__new__`, ensure `__init__` is called correctly. If encountering issues, test on 10.3.1 or later. Avoid directly calling `super().__init__` on `objc.objc_object` when using PyObjC's provided `__new__`.
If working with Python 3.13 or newer, be aware that free-threading support in PyObjC is still experimental. Avoid using PyObjC in a free-threaded context unless absolutely necessary and with thorough testing, or wait for a stable release with full free-threading guarantees.