PyObjC is a bridge between Python and Objective-C, enabling Python scripts to interact with Objective-C libraries, most notably macOS Cocoa frameworks. The `pyobjc-framework-opendirectory` package provides Python wrappers for the OpenDirectory and CFOpenDirectory frameworks on macOS. The project maintains an active and sustainable release cadence, typically aligning with macOS SDK updates and Python version support. The current version is 12.1.
pip install pyobjc-framework-opendirectoryVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the `OpenDirectory` framework and retrieve the default OpenDirectory session on macOS. It then attempts to list the available directory node names, showcasing basic interaction with the framework.
Ensure your Python version is compatible with the PyObjC version you are installing. PyObjC 12.1 requires Python >=3.10. Always check `requires_python` on PyPI or the PyObjC changelog for specific version requirements.
Review code that interacts with object initialization, especially custom subclasses or factory methods, to ensure correct reference handling. While explicit memory management is rarely needed in Python, understanding the underlying Objective-C semantics is crucial for correct behavior.
Ensure you are using PyObjC 10.3.1 or later if your Python classes override `__new__` and also define `__init__`.
If using custom Python subclasses of `NSProxy`, upgrade to PyObjC 12.1 or later to benefit from automatic KVO handling, or be aware of potential KVO interaction issues in older versions.
When using Python 3.13+ with PyObjC, be aware that free-threading support is experimental. Consult the PyObjC changelog for the latest status and any specific caveats or recommendations regarding thread safety.
Applications relying on `IMServicePlugIn` must update to alternative macOS APIs or ensure they are targeting an older macOS version and PyObjC release that still includes these bindings.