Registry /
communication / pyobjc-framework-coremidi
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
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CoreMIDI
✓ import CoreMIDI
MIDIObjectGetStringProperty
✓ from CoreMIDI import MIDIObjectGetStringProperty
This example demonstrates how to import the CoreMIDI framework and iterate through the available MIDI devices, printing their names. CoreMIDI is a low-level API; more complex interactions often require a deeper understanding of its C API and manual resource management.
import CoreMIDI
import objc
def list_midi_devices():
"""Lists all available CoreMIDI devices."""
print("MIDI Devices:")
num_devices = CoreMIDI.MIDIGetNumberOfDevices()
if num_devices == 0:
print(" No MIDI devices found.")
return
for i in range(num_devices):
midi_device_ref = CoreMIDI.MIDIGetDevice(i)
if midi_device_ref:
# MIDIObjectGetStringProperty returns a status code and the string value.
# PyObjC automatically bridges CFStringRef to Python string.
(name_result, name_str) = CoreMIDI.MIDIObjectGetStringProperty(
midi_device_ref, CoreMIDI.kMIDIPropertyName
)
if name_result == 0: # noErr
print(f" Device {i}: {name_str}")
else:
print(f" Device {i}: (Error getting name, code {name_result})")
else:
print(f" Device {i}: (Could not get device reference)")
if __name__ == "__main__":
list_midi_devices()
Debug
Known issues
breakingPython 3.9 support was dropped in PyObjC 12.0. Python 3.8 support was dropped in PyObjC 11.0. The current version requires Python >= 3.10.fixEnsure your Python environment is 3.10 or newer.
affects: >=11.0, >=12.0
gotchaCoreMIDI bindings are a low-level API, and for certain interactions, especially those not based on CoreFoundation or Objective-C types, users may need to perform manual reference counting. Some C functions like `MIDIDeviceCreate`, `MIDISend`, and event list manipulation (`MIDIEventListAdd`, `MIDIEventListInit`) are noted as requiring manual bindings or not being available from Python.fixConsult the PyObjC API Notes for CoreMIDI and Apple's CoreMIDI C API documentation for detailed usage and limitations.
affects: All
breakingPyObjC 11.1 aligned the core bridge's behavior with `clang`'s documentation for Automatic Reference Counting (ARC) regarding initializer methods. Methods in the 'init' family now correctly steal a reference to self and return a new reference, which differs from previous PyObjC versions' handling of partially initialized objects.fixReview custom Python subclasses of Objective-C classes, particularly `__new__` and `__init__` methods, to ensure compatibility with ARC behavior for initializers. Refer to `__init__` related breaking changes from v10.3/v10.3.1.
affects: >=11.1
gotchaExperimental support for free-threading (PEP 703) introduced in Python 3.13 is included in PyObjC 11, but PyObjC 10.3 explicitly did not support it. While PyObjC 12.1 supports Python 3.10+, if targeting Python 3.13 with free-threading, be aware of the experimental nature of this support.fixExercise caution and thorough testing when using PyObjC with experimental free-threading builds of Python 3.13 or newer. Stick to default Python builds for stable applications.
affects: >=10.3, >=11.0
gotchaThe behavior of `__init__` when a user implements `__new__` in Objective-C bridged classes changed in PyObjC 10.3 (dropping support for `__init__` in such cases) and was partially reintroduced in 10.3.1 due to breaking popular projects.fixIf encountering issues with `__init__` not being called after `__new__`, ensure you are on PyObjC 10.3.1 or later, and review the specific conditions under which `__init__` is supported when `__new__` is user-implemented versus provided by PyObjC.
affects: >=10.3, <=10.3.1
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredCore component providing the Python-Objective-C bridge.
pyobjc-framework-cocoaoptionalOften required indirectly or for broader macOS application development context.