PyObjC: Automatic Assessment Configuration Framework
Wrappers for the `AutomaticAssessmentConfiguration` framework on macOS, enabling Python applications to interact with Apple's API for creating secure assessment sessions. This library is part of the larger PyObjC project, currently at version 12.1, and receives regular updates to align with macOS SDK changes.
Warnings
- breaking PyObjC v12.0 dropped support for Python 3.9, and v11.0 dropped support for Python 3.8. Ensure your Python environment is 3.10 or newer.
- breaking PyObjC v11.1 introduced changes to how `init` family methods handle references, aligning with `clang`'s Automatic Reference Counting (ARC) documentation. Code relying on previous PyObjC reference counting behavior for Objective-C initializer methods might experience issues.
- gotcha Using the `AutomaticAssessmentConfiguration` framework requires your macOS application to have the `com.apple.developer.automatic-assessment-configuration` entitlement. Without this, attempts to use the framework will fail at runtime.
- gotcha Interactions between `__init__` and `__new__` when subclassing Objective-C classes can be tricky. PyObjC v10.3 initially removed `__init__` support when PyObjC's `__new__` was used, but v10.3.1 reintroduced `__init__` support when the user provides their own `__new__`.
- deprecated The older interface for `NSCoder.encodeBytes_length_forKey_` (used in `pyobjc-core` and potentially other frameworks) is deprecated in PyObjC 12 and will be removed in PyObjC 13. Ensure you are using the new three-argument interface if interacting with `NSCoder`.
Install
-
pip install pyobjc-framework-automaticassessmentconfiguration
Imports
- AutomaticAssessmentConfiguration
import AutomaticAssessmentConfiguration
- AEAssessmentSession
from AutomaticAssessmentConfiguration import AEAssessmentSession
Quickstart
import AutomaticAssessmentConfiguration
import objc
# The AutomaticAssessmentConfiguration framework is available from macOS 10.15.4.
# The main class is AEAssessmentSession. To use it, your app MUST have the
# 'com.apple.developer.automatic-assessment-configuration' entitlement.
print(f"PyObjC framework version: {AutomaticAssessmentConfiguration.__version__}")
if hasattr(AutomaticAssessmentConfiguration, 'AEAssessmentSession') and AutomaticAssessmentConfiguration.AEAssessmentSession is not objc.nil:
print("AutomaticAssessmentConfiguration.AEAssessmentSession class is available.")
# Example (requires entitlement and proper app lifecycle):
# session = AutomaticAssessmentConfiguration.AEAssessmentSession.alloc().init()
# # ... configure and begin session ...
# session.beginAssessmentSessionWithConfiguration_completionHandler_(None, lambda error: print(f'Session begin error: {error}'))
# # ... perform assessment ...
# session.endAssessmentSessionWithCompletionHandler_(lambda error: print(f'Session end error: {error}'))
else:
print("AutomaticAssessmentConfiguration.AEAssessmentSession class is not found or framework not loaded.")