Registry / auth-security / pyobjc-framework-securityfoundation

pyobjc-framework-securityfoundation

JSON →
library12.2pypypiunverified

PyObjC SecurityFoundation provides Python wrappers for the macOS SecurityFoundation framework, enabling Python scripts to interact with authorization services and other security-related APIs on macOS. It is part of the larger PyObjC project, which regularly releases updates, with the current version being 12.1.

pip install pyobjc-framework-securityfoundation
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-S
P
pyobjc-framework-securityfoundation
auth-securitypythonv12.2
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SFAuthorization
from SecurityFoundation import SFAuthorization
PyObjC maps macOS frameworks to Python packages with the same name. SFAuthorization is the primary class in the SecurityFoundation framework.

This quickstart demonstrates how to import the `SecurityFoundation` framework and obtain a default `SFAuthorization` object, which is a core component for interacting with macOS Authorization Services.

import SecurityFoundation import objc # Get a default SFAuthorization object auth = SecurityFoundation.SFAuthorization.authorization() if auth: print(f"Successfully obtained SFAuthorization object: {auth}") # Further operations would involve using methods on the 'auth' object # to perform authorization checks or privilege escalation. else: print("Failed to obtain SFAuthorization object.")
Debug
Known issues
breakingPython Version Support Drops: PyObjC has a policy of dropping support for older Python versions. PyObjC 12.0 dropped support for Python 3.9, and PyObjC 11.0 dropped support for Python 3.8. Always consult the release notes to ensure compatibility with your target Python and macOS versions.
fix
Upgrade Python to a supported version (e.g., Python 3.10+ for PyObjC 12.1).
affects: 11.0, 12.0+
breakingChanges in `__init__` and `__new__` behavior: In PyObjC 10.3, calling `__init__` on subclasses that rely on PyObjC's `__new__` was disabled. While partially reintroduced in 10.3.1 for user-implemented `__new__`, code relying on the PyObjC-provided `__new__` cannot use `__init__`. This can break existing subclassing patterns.
fix
Adopt the `alloc().init()` pattern for object creation, or ensure `__new__` is explicitly implemented by the user if `__init__` is needed.
affects: 10.3, 10.3.1+
breakingRemoval of `IMServicePlugIn` Bindings: The `IMServicePlugIn` framework bindings were entirely removed in PyObjC 10.0, as the underlying framework was deprecated by Apple in macOS 10.13 and removed in macOS 14.
fix
Remove any dependencies on `IMServicePlugIn`. Applications needing similar functionality may need to find alternative macOS APIs or adjust their design.
affects: 10.0+
gotchaKVO (Key-Value Observing) for `NSProxy` Subclasses: As of PyObjC 12.1, KVO usage is automatically disabled for Python subclasses of `NSProxy`. Attempting to use KVO with these subclasses can lead to `SystemError`.
fix
Avoid using KVO with Python subclasses of `NSProxy`. If KVO-like functionality is required, implement a custom observation mechanism.
affects: 12.1+
gotcha`os.fspath` with Cocoa URLs: Prior to PyObjC 10.1, `os.fspath()` would raise a `TypeError` when used with Cocoa URL objects (`NSURL`, `CFURLRef`) that referred to local filesystem paths. This was fixed in 10.1.
fix
If using PyObjC versions older than 10.1, convert Cocoa URL objects to Python string paths manually before passing them to `os.fspath()`. Upgrade to 10.1 or newer to use `os.fspath()` directly.
affects: <10.1
gotcha`bytearray` as C `char*` argument: In versions prior to 12.1, passing a `bytearray` directly to an Objective-C function or selector expecting a null-terminated C char array might have required manual conversion. As of 12.1, `bytearray` instances can be used directly.
fix
For older versions, ensure `bytearray` is explicitly converted (e.g., `str(b.decode('utf-8'))` or `b'...' + b'\0'`) if a null-terminated C string is expected. Upgrade to 12.1+ to use `bytearray` directly.
affects: <12.1
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredThis package provides bindings for a specific macOS framework and relies on the core PyObjC bridge functionality.
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
pyobjc-framework-securityfoundation — pip install pyobjc-framework-securityfoundation · libregistry