PyObjC Framework FileProviderUI
PyObjC is a bidirectional bridge between Python and Objective-C, enabling Python scripts to use and extend macOS's Cocoa frameworks. `pyobjc-framework-fileproviderui` provides Python wrappers for the `FileProviderUI` framework on macOS, allowing developers to interact with File Provider UI extensions. The PyObjC project, including this framework wrapper, maintains an active development cycle with frequent minor releases and major versions often aligning with new macOS SDKs.
Warnings
- breaking PyObjC 12.0 dropped support for Python 3.9. PyObjC 11.0 dropped support for Python 3.8. Ensure your Python version meets the `>=3.10` requirement.
- breaking The behavior of `__init__` for Objective-C classes subclassed in Python changed in PyObjC 10.3, leading to breakage for projects using `__init__` in conjunction with a `__new__` provided by PyObjC. This was partially reverted in 10.3.1 to allow `__init__` when a user-defined `__new__` is present, but code relying on PyObjC's default `__new__` still cannot use `__init__`.
- gotcha PyObjC 11.0 introduced experimental support for free-threading (PEP 703) with Python 3.13. While this aims to improve concurrency, it involved significant changes in the core bridge and might introduce unexpected behavior or require specific handling in multithreaded applications.
- gotcha When pinning dependencies for cross-platform projects, `pyobjc-core` (and by extension framework wrappers) should be explicitly restricted to macOS using `sys_platform == "darwin"` in `requirements.txt` or similar, as installation will fail on non-macOS platforms.
- gotcha Some Cocoa classes are marked as non-subclassable in the macOS SDK. Attempting to subclass these from Python via PyObjC can lead to crashes.
- deprecated The `isAlloc` attribute of `objc.selector` has been deprecated and is scheduled for removal in PyObjC 12.
Install
-
pip install pyobjc-framework-fileproviderui
Imports
- FileProviderUI
import FileProviderUI
Quickstart
import FileProviderUI
import Foundation # Often needed for basic Cocoa objects like NSString, NSObject
def main():
print(f"FileProviderUI module loaded: {FileProviderUI}")
# Try to access a known class from the framework and print its description
# FPUIActionExtensionContext is a common class in FileProviderUI
if hasattr(FileProviderUI, 'FPUIActionExtensionContext'):
context_class = FileProviderUI.FPUIActionExtensionContext
print(f"FPUIActionExtensionContext class: {context_class}")
print(f"Description of FPUIActionExtensionContext: {context_class.description()}")
else:
print("FPUIActionExtensionContext not found. This might indicate an older macOS SDK or an internal API.")
if __name__ == "__main__":
main()