{"id":6081,"library":"pyobjc-framework-classkit","title":"PyObjC ClassKit Framework","description":"PyObjC-framework-ClassKit provides Python wrappers for the ClassKit framework on macOS, enabling Python applications to interact with educational data like assignments, activities, and progress. It is part of the broader PyObjC project, currently at version 12.1, and typically releases updates in sync with macOS SDK changes.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","cocoa","framework","classkit","objective-c","pyobjc"],"install":[{"cmd":"pip install pyobjc-framework-classkit","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"All pyobjc-framework-* packages depend on the core bridge.","package":"pyobjc-core","optional":false}],"imports":[{"symbol":"ClassKit","correct":"import ClassKit"},{"symbol":"CLSContext","correct":"import ClassKit\ncontext = ClassKit.CLSContext.currentContext()"}],"quickstart":{"code":"import ClassKit\nfrom Cocoa import NSObject, NSLog # For basic logging or NSObject base\n\n# ClassKit operations must typically be run on the main thread and\n# within a macOS application context. This is a conceptual example.\n# In a real app, you would interact with CLSDataStore and CLSContext.\n\n# Get the current ClassKit context (requires user authorization and an active app)\ncurrent_context = ClassKit.CLSContext.currentContext()\n\nif current_context:\n    NSLog(f\"ClassKit context loaded: {current_context.title()}\")\n    # Example: Create a new activity for the current context\n    # This part requires proper setup of CLSActivity, CLSActivityItem etc.\n    # and permissions. This is a simplified example.\n    # activity = ClassKit.CLSActivity()\n    # activity.setTitle_(\"My Python Activity\")\n    # current_context.addActivity_(activity)\n    # ClassKit.CLSDataStore.shared().saveWithCompletion_(\n    #     lambda success, error: NSLog(f\"Activity save success: {success}, error: {error}\")\n    # )\nelse:\n    NSLog(\"ClassKit context not available. Ensure app is authorized and running on macOS.\")\n\n# In a real macOS app, you might also have a PyObjC application loop running.","lang":"python","description":"This quickstart demonstrates how to import the ClassKit framework and access the current ClassKit context. Note that ClassKit operations require an active macOS application context, appropriate entitlements, and user authorization to function correctly. This code is illustrative and would typically run within a larger PyObjC-based macOS application."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or newer if using PyObjC 12.x, or 3.9 or newer if using PyObjC 11.x.","message":"Python 3.9 support was dropped in PyObjC 12.0, and Python 3.8 support was dropped in PyObjC 11.0. Ensure your Python version meets the requirements for the installed PyObjC version (e.g., PyObjC 12.x requires Python >=3.10).","severity":"breaking","affected_versions":">=11.0"},{"fix":"Review PyObjC code that defines or interacts with Objective-C initializer methods to ensure correct reference counting and object lifecycle management, especially when upgrading from versions prior to 11.1.","message":"PyObjC 11.1 introduced significant changes to align the core bridge's Automatic Reference Counting (ARC) behavior with `clang`'s documentation, particularly for initializer methods. Methods in the 'init' family now correctly steal a reference to `self` and return a new one.","severity":"breaking","affected_versions":">=11.1"},{"fix":"Develop and deploy applications using this library exclusively on macOS. Ensure your application has the correct entitlements and permissions configured in Xcode if interacting with system services.","message":"ClassKit, like all PyObjC frameworks, is specific to macOS. Code using `pyobjc-framework-classkit` will only run on macOS and requires the necessary macOS SDKs and entitlements for specific operations (e.g., accessing sensitive educational data).","severity":"gotcha","affected_versions":"All versions"},{"fix":"If encountering issues with `__init__` and `__new__` for custom Objective-C classes, upgrade to PyObjC 10.3.1 or later. Avoid using `__init__` if your class relies on PyObjC's default `__new__` implementation.","message":"In PyObjC 10.3, the ability to use `__init__` when a user also provided `__new__` was temporarily removed, causing issues. This was reinstated in version 10.3.1. Code relying on PyObjC's provided `__new__` still cannot use `__init__`.","severity":"gotcha","affected_versions":"10.3"},{"fix":"Regularly check release notes for major PyObjC versions for any removed framework bindings. Update your application's dependencies or logic if a previously used framework is no longer available in PyObjC.","message":"Older Objective-C frameworks might be removed from PyObjC bindings in newer versions if they are deprecated or removed from macOS. For example, 'IMServicePlugIn' bindings were removed in PyObjC 10.0 due to its deprecation and removal in macOS.","severity":"breaking","affected_versions":">=10.0 (and subsequent major releases)"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}