{"library":"pyobjc-framework-inputmethodkit","title":"PyObjC InputMethodKit Framework","description":"PyObjC-framework-InputMethodKit provides Python wrappers for Apple's InputMethodKit framework on macOS, allowing developers to create custom input methods using Python. It is part of the larger PyObjC project, which acts as a bridge between Python and Objective-C. The library is actively maintained with frequent releases, often synchronized with new macOS SDK versions and Python language updates.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-inputmethodkit"],"cli":null},"imports":["import InputMethodKit","from InputMethodKit import IMKInputController"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import InputMethodKit\nimport objc\nfrom Foundation import NSObject, NSLog, NSBundle\n\n# Define a simple input controller, subclassing IMKInputController\nclass MyInputController(InputMethodKit.IMKInputController):\n    def init(self):\n        self = objc.super(MyInputController, self).init()\n        if self is None:\n            return None\n        NSLog(\"MyInputController initialized!\")\n        return self\n\n    def activateServer_(self, sender):\n        NSLog(\"Input Method activated!\")\n        return True\n\n    def deactivateServer_(self, sender):\n        NSLog(\"Input Method deactivated!\")\n        return True\n\n    # In a real input method, you'd implement methods like handleEvent_, keyUp_ etc.\n\ndef main():\n    # In a real Input Method, the name and bundleIdentifier are crucial\n    # and typically defined in the application's Info.plist.\n    # For this conceptual example, we use placeholders.\n    input_method_name = \"MyPyIM\"\n    # This bundle ID *must* match the bundle ID in your Info.plist\n    # for a functional Input Method application.\n    bundle_id = \"com.example.MyPyIM\"\n\n    # Create an IMKServer instance.\n    # The server manages client connections and dispatches events to input controllers.\n    server = InputMethodKit.IMKServer.alloc().initWithName_bundleIdentifier_(\n        input_method_name,\n        bundle_id\n    )\n\n    NSLog(\"IMKServer created for name: %@, bundleIdentifier: %@\", input_method_name, bundle_id)\n    NSLog(\"\\n*** IMPORTANT ***\\n\")\n    NSLog(\"To create a functional macOS Input Method, this Python script must be packaged\")\n    NSLog(\"inside a .app bundle with a correctly configured Info.plist (e.g., using py2app).\")\n    NSLog(\"This quickstart only demonstrates the basic class instantiation and setup.\")\n    \n    # A real Input Method would then typically run an AppHelper.runEventLoop()\n    # from PyObjCTools to handle events and keep the application running.\n    # For simplicity, we omit the blocking event loop here.\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates how to import the `InputMethodKit` framework and instantiate its core classes. Note that building a functional macOS Input Method requires additional setup, including creating an application bundle (e.g., via `py2app`) and configuring a proper `Info.plist` file with specific Input Method related keys. This code snippet focuses on the PyObjC API usage, not the complete application deployment.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":null,"pypi_latest":"12.1","is_stale":null,"summary":{"python_range":"3.10–3.9","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.9,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyobjc-framework-inputmethodkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.5,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}