{"library":"pyobjc-framework-webkit","title":"PyObjC WebKit Framework Bindings","description":"PyObjC-framework-WebKit provides Python wrappers for Apple's WebKit and JavaScriptCore frameworks on macOS, enabling Python applications to embed web content and execute JavaScript. It is part of the larger PyObjC project, which acts as a bridge between Python and Objective-C. The library is actively maintained with regular updates to support new macOS SDKs and Python versions, typically following a release cadence aligned with major macOS and Python releases.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-webkit"],"cli":null},"imports":["import WebKit","import AppKit","import Foundation"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import AppKit\nimport Foundation\nimport WebKit\n\nclass AppDelegate(AppKit.NSObject):\n    def applicationDidFinishLaunching_(self, notification):\n        rect = Foundation.NSMakeRect(0, 0, 800, 600)\n        self.window = AppKit.NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(\n            rect, AppKit.NSWindowStyleMaskTitled | AppKit.NSWindowStyleMaskClosable | AppKit.NSWindowStyleMaskResizable, AppKit.NSBackingStoreBuffered, False\n        )\n        self.window.setTitle_(\"PyObjC WebKit Demo\")\n\n        self.webView = WebKit.WKWebView.alloc().initWithFrame_(rect)\n        self.window.contentView().addSubview_(self.webView)\n\n        url = Foundation.NSURL.URLWithString_(\"https://www.apple.com/\" if not Foundation.NSBundle.mainBundle().bundleIdentifier() else \"https://www.google.com\")\n        request = Foundation.NSURLRequest.requestWithURL_(url)\n        self.webView.loadRequest_(request)\n\n        self.window.makeKeyAndOrderFront_(None)\n\n    def applicationShouldTerminateAfterLastWindowClosed_(self, sender):\n        return True\n\nif __name__ == \"__main__\":\n    app = AppKit.NSApplication.sharedApplication()\n    delegate = AppDelegate.alloc().init()\n    app.setDelegate_(delegate)\n    app.run()","lang":"python","description":"This minimal example demonstrates how to create a basic macOS application window using AppKit and embed a WKWebView to display a webpage. It defines an AppDelegate to manage the application lifecycle and sets up a window with a WKWebView loading a URL. To run this, save it as a .py file and execute it on macOS with PyObjC installed. Note that a full macOS application with an Info.plist and bundle identifier is typically created using tools like `py2app` for deployment, but this script provides a runnable demonstration within a standard Python environment. The URL is conditionally set to avoid issues when run from an unbundled script without a default bundle ID.","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-webkit","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-webkit","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.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyobjc-framework-webkit","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-webkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.1,"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-webkit","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-webkit","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.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyobjc-framework-webkit","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-webkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.6,"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-webkit","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-webkit","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.4,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}