Registry / ai-ml / pyobjc-framework-metalperformanceshaders

pyobjc-framework-metalperformanceshaders

JSON →
library12.2pypypiunverified

PyObjC is a bridge between Python and Objective-C that allows Python applications to use Objective-C frameworks and objects. `pyobjc-framework-metalperformanceshaders` provides Python bindings for Apple's MetalPerformanceShaders framework on macOS, offering highly optimized GPU-accelerated functions for tasks like image processing, machine learning, and physics simulations. The library is actively maintained, with version 12.1 being the latest as of November 2025, and receives frequent updates tied to new macOS SDK releases.

pip install pyobjc-framework-metalperformanceshaders
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-M
P
pyobjc-framework-metalperformanceshaders
ai-mlpythonv12.2
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.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.103.920 runs
build_error
glibc
py 3.103.920 runs
build_error
Code
Verified usage

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

MetalPerformanceShaders
import MetalPerformanceShaders
All classes and functions from the MetalPerformanceShaders framework are exposed under the `MetalPerformanceShaders` module.

This quickstart demonstrates how to import the `MetalPerformanceShaders` framework through PyObjC and access a basic class like `MPSKernel`. Real-world usage of this framework is highly dependent on Apple's Metal API, requiring a Metal device, command queue, and texture management for actual GPU-accelerated operations.

import objc from Foundation import NSObject # Often implicitly imported or used by other frameworks import MetalPerformanceShaders # Accessing a basic class from the framework # MPSKernel is a base class for many Metal Performance Shaders operations. try: # Simply accessing the class confirms the import and binding are working. _ = MetalPerformanceShaders.MPSKernel print("Successfully imported MetalPerformanceShaders and accessed MPSKernel.") # Note: Full usage of MetalPerformanceShaders (e.g., creating a blur filter, # running a neural network, or performing ray tracing) is complex. # It requires setting up a Metal device, command queue, and textures. # For example: # from Metal import MTLCreateSystemDefaultDevice # device = MTLCreateSystemDefaultDevice() # commandQueue = device.newCommandQueue() # # ... then create MPSImageGaussianBlur, encode to command buffer, etc. print("Note: Actual usage of MetalPerformanceShaders requires a Metal context (device, command queue, textures). Refer to Apple's Metal Performance Shaders documentation for details.") except objc.nosuchmethod_error as e: print(f"Error accessing MetalPerformanceShaders.MPSKernel: {e}") print("This might indicate an issue with the framework bindings or an incompatible macOS version.") except ImportError as e: print(f"Error importing MetalPerformanceShaders: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breaking`pyobjc-framework-metalperformanceshaders` version 12.0 dropped support for Python 3.9. Version 11.0 dropped support for Python 3.8. Ensure your Python version meets the `pyobjc` requirements (currently Python >=3.10).
fix
Upgrade to Python 3.10 or later for PyObjC 12.x, or Python 3.9 or later for PyObjC 11.x.
affects: 11.0, 12.0
breakingPyObjC 10.3 introduced changes to how `__init__` and `__new__` methods are handled when subclassing Objective-C classes in Python. While a partial revert in 10.3.1 allowed `__init__` when a user-defined `__new__` exists, it can still break code relying on the old behavior where `__init__` was called regardless. The recommended pattern is to use `SomeClass.alloc().init()` or the more Pythonic `SomeClass(...)` (introduced in PyObjC 10.3) for object initialization.
fix
Review custom Python subclasses of Objective-C classes and adapt initialization logic to use `SomeClass.alloc().init()` or `SomeClass(...)`. If providing a custom `__new__`, ensure `__init__` is correctly called if desired.
affects: 10.3, 10.3.1
gotchaPyObjC framework bindings, including `pyobjc-framework-metalperformanceshaders`, do not include their own documentation. Users must refer to Apple's official Objective-C and Swift documentation for the MetalPerformanceShaders framework to understand the available APIs and their usage.
fix
Consult Apple's Metal Performance Shaders documentation for API specifics and usage examples.
affects: All versions
gotchaInstalling PyObjC from source (e.g., using `pip install --no-binary :all: pyobjc`) requires a full Xcode installation or the Xcode Command Line Tools to be present, along with a sufficiently new macOS SDK. Building with an older SDK can lead to compilation errors due to missing protocol declarations or other API changes.
fix
Ensure Xcode and its Command Line Tools are installed and updated (`xcode-select --install`). For binary wheels, this is usually not an issue.
affects: All versions (when installing from source)
deprecatedThe `isAlloc` attribute of `objc.selector` is deprecated and will be removed in PyObjC 12. While this change is primarily internal to the bridge, users with highly specialized code that directly inspects `objc.selector` attributes should be aware.
fix
Avoid direct reliance on the `isAlloc` attribute of `objc.selector`. Consult PyObjC documentation for alternative approaches if needed.
affects: 11.x and earlier
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredThis package provides the core bridging functionality between Python and Objective-C, essential for all PyObjC framework bindings.
Agent activity
6 hits · last 30 days
node
4
OpenAI (training)
2
Resources
pyobjc-framework-metalperformanceshaders — pip install pyobjc-framework-metalperformanceshaders · libregistry