Registry / type-stubs / pyobjc-framework-iosurface

pyobjc-framework-iosurface

JSON →
library12.2pypypiunverified

PyObjC is a bridge between Python and Objective-C, enabling Python scripts to interact with and extend macOS's Cocoa libraries and other Objective-C frameworks. The `pyobjc-framework-iosurface` package provides Python wrappers specifically for Apple's IOSurface framework, which allows applications to share graphics buffers efficiently across processes. It is actively maintained, with version 12.1 being the latest, and sees regular updates to support new macOS SDKs and Python versions.

pip install pyobjc-framework-iosurface
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-I
P
pyobjc-framework-iosurface
type-stubspythonv12.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.

IOSurface
✓ import IOSurface
Accesses the IOSurface framework bindings directly.

This quickstart demonstrates how to create a basic IOSurface object with specified dimensions and pixel format. It highlights how Python dictionaries and primitive types are automatically bridged to their CoreFoundation equivalents for IOSurface creation. The resulting IOSurface object provides access to its properties, such as ID, width, and height.

import IOSurface # Define properties for the IOSurface # PyObjC automatically bridges Python dictionaries to CFDictionary # and Python integers/booleans to CFNumber/CFBoolean. properties = { IOSurface.kIOSurfaceWidth: 640, IOSurface.kIOSurfaceHeight: 480, IOSurface.kIOSurfaceBytesPerElement: 4, # e.g., 4 bytes per pixel for 32-bit color IOSurface.kIOSurfacePixelFormat: 0x42524741, # Example: 'ARGB' (Big-endian equivalent) # IOSurface.kIOSurfaceBytesPerRow: 640 * 4, # Can be derived or explicitly set } # Create the IOSurface surface = IOSurface.IOSurfaceCreate(properties) if surface: print(f"Successfully created IOSurface: {surface}") print(f"IOSurface ID: {IOSurface.IOSurfaceGetID(surface)}") print(f"IOSurface Width: {IOSurface.IOSurfaceGetWidth(surface)}") print(f"IOSurface Height: {IOSurface.IOSurfaceGetHeight(surface)}") # The 'surface' object's memory is managed by Objective-C's ARC, # but the Python wrapper will be garbage collected. else: print("Failed to create IOSurface.")
Debug
Known issues
breakingPyObjC 12.0 dropped support for Python 3.9, and PyObjC 11.0 dropped support for Python 3.8. Users must ensure their Python version meets the `requires_python` specification (currently >=3.10) to use recent PyObjC versions.
fix
Upgrade Python to version 3.10 or later, or use an older PyObjC version compatible with your Python environment.
affects: >=11.0
breakingPyObjC 11.1 introduced a significant change in how initializer methods (those in the 'init' family) handle object references, aligning with `clang`'s Automatic Reference Counting (ARC) documentation. This means `init` methods are now correctly modeled to steal a reference to `self` and return a new one.
fix
Review custom Python subclasses of Objective-C objects, especially those overriding `init` methods, to ensure correct reference handling if manual memory management was previously assumed. PyObjC generally handles ARC transparently, but this change ensures stricter compliance.
affects: >=11.1
gotchaPyObjC translates Objective-C selectors (method names) with embedded colons (e.g., `doSomething:withSomethingElse:`) into Python method names where colons are replaced by underscores (e.g., `doSomething_withSomethingElse_`). Each underscore indicates an argument.
fix
When calling Objective-C methods from Python via PyObjC, convert the Objective-C selector by replacing each colon with an underscore. The number of underscores corresponds to the number of arguments expected by the method.
affects: all
gotchaIn PyObjC 10.3, behavior around `__init__` when a user implements `__new__` was modified, potentially breaking some popular projects. Version 10.3.1 partially reverted this, reintroducing the ability to use `__init__` if `__new__` is user-implemented. However, code relying on PyObjC's provided `__new__` still cannot use `__init__` for reasons explained in the 10.3 release notes.
fix
If subclassing Objective-C classes in Python and implementing `__new__`, be aware of `__init__`'s behavior. For classes where PyObjC provides `__new__`, avoid implementing `__init__`. For user-implemented `__new__`, `__init__` can be used as of 10.3.1.
affects: 10.3 - 10.3.1
deprecatedPyObjC 10.0 removed bindings for the `IMServicePlugIn` framework as the framework itself was deprecated in macOS 10.13 and removed in macOS 14. This indicates a general trend where bindings for deprecated macOS frameworks may be removed in future PyObjC releases.
fix
Before relying on specific framework bindings, check their deprecation status in Apple's documentation. If a framework is deprecated or removed in macOS, its PyObjC bindings will likely be removed in a future release.
affects: >=10.0
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredProvides the core Python-Objective-C bridge functionality, essential for all PyObjC framework bindings.
Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
2
Resources
pyobjc-framework-iosurface — pip install pyobjc-framework-iosurface · libregistry