Registry / pyobjc-framework-avkit

pyobjc-framework-avkit

JSON →
library12.2pypypiunverified

PyObjC is a bridge between Python and Objective-C, enabling Python scripts to use and extend macOS Cocoa libraries. `pyobjc-framework-avkit` provides Python wrappers for Apple's AVKit framework on macOS, allowing developers to integrate video playback and related UI elements into Python applications. It is part of the larger PyObjC project, which is actively maintained with frequent updates to support new macOS SDKs and Python versions. The current version is 12.1.

pip install pyobjc-framework-avkit
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-A
P
pyobjc-framework-avkit
pythonv12.2
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.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.10–3.940 runs
build_error
glibc
py 3.10–3.940 runs
build_error
Code
Verified usage

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

AVPlayer
✓ from AVKit import AVPlayer
AVPlayerViewController
✓ from AVKit import AVPlayerViewController
NSApplication
✓ from AppKit import NSApplication
Commonly used for application lifecycle management alongside AVKit.
NSURL
✓ from Foundation import NSURL
Commonly used for specifying media URLs, part of the Foundation framework.

This example demonstrates how to create a basic macOS application using PyObjC that displays and plays a video using AVKit. It sets up an `NSApplication` with an `NSWindow` and embeds an `AVPlayerViewController` to play a video from a URL. Remember that Objective-C method calls are translated to Python by replacing colons with underscores and appending an underscore for each argument.

import objc from Foundation import NSURL from AppKit import NSApplication, NSWindow, NSView, NSNotificationCenter, NSApplicationDidFinishLaunchingNotification, NSObject, NSRect from AVKit import AVPlayer, AVPlayerViewController class AppDelegate(NSObject): def applicationDidFinishLaunching_(self, notification): print("Application finished launching.") self.mainWindow = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_( NSRect(100, 100, 640, 480), 4|8|16|1, # Titled | Closable | Miniaturizable | Resizable 2, # Backing store buffered False # Not deferred ) self.mainWindow.setTitle_("PyObjC AVKit Demo") # Create an AVPlayer with a sample video URL video_url = NSURL.URLWithString_("https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4") self.player = AVPlayer.playerWithURL_(video_url) # Create an AVPlayerViewController self.playerViewController = AVPlayerViewController.alloc().init() self.playerViewController.setPlayer_(self.player) # Add the player view controller's view to the window's content view playerView = self.playerViewController.view() playerView.setFrame_(self.mainWindow.contentView().bounds()) playerView.setAutoresizingMask_(NSView.ViewWidthSizable | NSView.ViewHeightSizable) self.mainWindow.contentView().addSubview_(playerView) self.mainWindow.makeKeyAndOrderFront_(self) self.player.play() def main(): app = NSApplication.sharedApplication() delegate = AppDelegate.alloc().init() app.setDelegate_(delegate) NSApplication.sharedApplication().run() if __name__ == '__main__': main()
Debug
Known issues
breakingPyObjC 12.0 dropped support for Python 3.9. Ensure your Python version is 3.10 or newer.
fix
Upgrade to Python 3.10 or later, or use PyObjC <12.0.
affects: >=12.0
breakingPyObjC 11.0 dropped support for Python 3.8. Ensure your Python version is 3.9 or newer.
fix
Upgrade to Python 3.9 or later, or use PyObjC <11.0.
affects: >=11.0, <12.0
gotchaPyObjC 11.1 aligned initializer method behavior with `clang`'s documentation for automatic reference counting. Methods in the 'init' family now correctly steal a reference to `self` and return a new reference, which might change behavior for custom initializers or subclasses.
fix
Review custom Objective-C initializers and Python subclasses that override `init` methods to ensure correct reference handling based on ARC rules.
affects: >=11.1
gotchaWhen subclassing Objective-C classes in Python and implementing both `__new__` and `__init__`, PyObjC 10.3 initially broke the ability to use `__init__`. While partially re-enabled in 10.3.1 for user-defined `__new__`, code relying on PyObjC's provided `__new__` still cannot use `__init__`.
fix
Avoid using `__init__` in conjunction with PyObjC-provided `__new__` for Objective-C subclasses. For user-defined `__new__`, verify `__init__` behavior with 10.3.1+.
affects: >=10.3, <10.3.1 (full impact); >=10.3.1 (partial impact)
gotchaPyObjC is a macOS-specific library and will not run on other operating systems.
fix
Ensure development and deployment environment is macOS.
affects: All versions
gotchaObjective-C method names containing colons (`:`) are translated to Python with underscores (`_`) replacing colons, and an additional trailing underscore for each argument. E.g., `method:arg1 withOtherArgs:arg2` becomes `method_withOtherArgs_(arg1, arg2)`.
fix
Consult Objective-C documentation and apply the colon-to-underscore translation when calling methods from Python.
affects: All versions
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredProvides the core bridge between Python and Objective-C, required by all PyObjC framework wrappers.
Agent activity
2 hits · last 30 days
node
2
Resources
pyobjc-framework-avkit — pip install pyobjc-framework-avkit · libregistry