Registry / web-framework / pyobjc

pyobjc

JSON →
library12.2.2pypypiunverified

PyObjC is a bridge between Python and Objective-C, allowing Python scripts to use and extend existing Objective-C class libraries, most importantly Apple's Cocoa. It enables the development of full-featured macOS applications in pure Python and seamless integration with Objective-C, C, and C++ code. PyObjC (version 12.1) is actively maintained and typically releases new versions aligning with macOS SDK updates and Python version support.

pip install pyobjc
INSTALL
IMPORT
SIG · PYOBJC
P
pyobjc
web-frameworkpythonv12.2.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.910 runs
build_error
glibc
py 3.103.910 runs
build_error
Code
Verified usage

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

objc
import objc
Core bridge module for PyObjC utilities and functions.
Foundation
from Foundation import NSObject, NSString
Commonly imported framework for basic Objective-C types and utilities.
AppKit
from AppKit import NSApplication, NSWindow
Commonly imported framework for macOS user interface elements (Cocoa applications).

This example demonstrates fundamental PyObjC interactions: creating Objective-C `NSString` and `NSArray` objects, calling their methods, accessing PyObjC's `objc.YES`/`NO`/`nil` constants, and using `objc.autorelease_pool` for memory management.

import objc from Foundation import NSString, NSArray # Working with Objective-C classes hello = NSString.stringWithString_("Hello, World!") print(f"Hello string length: {hello.length()}") # Expected: 13 # Creating and using Objective-C objects # Note the 'None' to signify the end of the variadic arguments for arrayWithObjects_ my_array = NSArray.arrayWithObjects_("foo", "bar", "baz", None) print(f"Array count: {my_array.count()}") # Expected: 3 print(f"Object at index 1: {my_array.objectAtIndex_(1)}") # Expected: bar # Using the bridge constants print(f"objc.YES: {objc.YES}") # Expected: True print(f"objc.NO: {objc.NO}") # Expected: False print(f"objc.nil: {objc.nil}") # Expected: None # Proper memory management with autorelease pools (good practice for intensive ops) with objc.autorelease_pool(): temp_strings = [] for i in range(5): temp_string = NSString.stringWithFormat_("Item %d", i) temp_strings.append(temp_string) print(f"Temporary strings created: {len(temp_strings)}") # Objects are automatically released when the pool exits
Debug
Known issues
breakingPyObjC has dropped support for older Python versions in recent major releases. Version 12.0 dropped Python 3.9, and Version 11.0 dropped Python 3.8. Ensure your Python environment meets the minimum requirement (Python 3.10+ for PyObjC 12.x).
fix
Upgrade your Python interpreter to 3.10 or later for PyObjC 12.x. Always check the official PyObjC documentation for the latest supported Python versions for your PyObjC release.
affects: 10.0, 11.0, 12.0
breakingPyObjC 11.1 introduced significant changes to align with `clang`'s documentation for Automatic Reference Counting (ARC) for initializer methods. Methods in the 'init' family now correctly model stealing a reference to `self` and returning a new one. This can cause reference counting bugs to surface or lead to crashes if existing code relied on previous, incorrect behavior.
fix
Review Objective-C initializer method calls and reference counting in your Python code, especially if manually managing object lifetimes or dealing with 'partially initialized' objects. Prefer the Pythonic `SomeClass(...)` initialization over `SomeClass.alloc().init()` where possible.
affects: >=11.1
gotchaObjective-C method names containing colons (e.g., `doSomething:withSomethingElse:`) are translated to Python by replacing colons with underscores (e.g., `doSomething_withSomethingElse_`). Each underscore signifies an argument. Missing an underscore or an argument will result in `AttributeError` or unexpected behavior.
fix
Always convert Objective-C selectors by replacing colons with underscores. The number of underscores in the Python method name must match the number of arguments (including the implicit `self`).
affects: All
gotchaUsing `__init__` in Python subclasses of Objective-C classes can have subtle interactions with `__new__`. While PyObjC 10.3 initially removed support for calling `__init__` when a user-defined `__new__` was present, this was partially reintroduced in 10.3.1. Code relying on PyObjC's provided `__new__` still cannot use `__init__`.
fix
If implementing custom `__new__` methods in Objective-C subclasses, be cautious with `__init__` behavior. Prefer using Objective-C's `init` methods directly or the `SomeClass(...)` factory when possible, rather than relying on Python's `__init__` for complex initialization logic.
affects: >=10.3
breakingThe `AVFAudio` framework, previously merged into `AVFoundation` bindings, was split into its own top-level package (`pyobjc-framework-AVFAudio`) starting with PyObjC 12.0.
fix
If your application explicitly uses `AVFAudio` components, you may need to adjust your imports and ensure `pyobjc-framework-AVFAudio` is installed, although it's typically included with `pyobjc-framework-AVFoundation`.
affects: >=12.0
gotchaPyObjC is specifically designed for CPython on macOS. It does not support alternative Python runtimes like PyPy, Jython, or IronPython, and this is unlikely to change.
fix
Ensure you are using a standard CPython installation on macOS for PyObjC development.
affects: All
Upgrade
Version history
12.2.2latest on PyPI · released Aug 11, 2026
Audit
Dependencies
pyobjc-corerequiredThe fundamental bridge implementation for Python-Objective-C interoperability.
pyobjc-framework-*optionalSpecialized packages providing Python bindings for specific macOS frameworks (e.g., Cocoa, AppKit, Foundation, AVFoundation). The 'pyobjc' meta-package installs many of these.
Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
pyobjc — pip install pyobjc · libregistry