./devel/py-pyobjc, Bridge between Python and Objective-C

[ Image CVSweb ] [ Image Homepage ] [ Image RSS ] [ Image Required by ]


Branch: CURRENT, Version: 12.2, Package name: py313-pyobjc-12.2, Maintainer: pkgsrc-users

The PyObjC project aims to provide a bridge between the Python and Objective-C
programming languages. The bridge is intended to be fully bidirectional,
allowing the Python programmer to take full advantage of the power provided by
various Objective-C based toolkits and the Objective-C programmer transparent
access to Python based functionality.


Required to run:
[devel/py-pyobjc-framework-InstantMessage] [devel/py-pyobjc-framework-CoreWLAN] [devel/py-pyobjc-framework-WebKit] [devel/py-pyobjc-framework-LaunchServices] [devel/py-pyobjc-framework-Automator] [devel/py-pyobjc-framework-AddressBook] [devel/py-pyobjc-framework-DiskArbitration] [devel/py-pyobjc-framework-DictionaryServices] [devel/py-pyobjc-framework-PreferencePanes] [devel/py-pyobjc-framework-AppleScriptObjC] [devel/py-pyobjc-core] [devel/py-pyobjc-framework-ServiceManagement] [devel/py-pyobjc-framework-Accounts] [devel/py-pyobjc-framework-CFNetwork] [devel/py-pyobjc-framework-CalendarStore] [devel/py-pyobjc-framework-Cocoa] [devel/py-pyobjc-framework-CoreData] [devel/py-pyobjc-framework-CoreLocation] [devel/py-pyobjc-framework-ExceptionHandling] [devel/py-pyobjc-framework-FSEvents] [devel/py-pyobjc-framework-InputMethodKit] [devel/py-pyobjc-framework-QTKit] [devel/py-pyobjc-framework-Quartz] [devel/py-pyobjc-framework-ScreenSaver] [devel/py-pyobjc-framework-SearchKit] [devel/py-pyobjc-framework-Social] [devel/py-pyobjc-framework-StoreKit] [devel/py-pyobjc-framework-Collaboration] [devel/py-pyobjc-framework-SystemConfiguration] [devel/py-pyobjc-framework-CoreText] [devel/py-pyobjc-framework-SyncServices] [devel/py-pyobjc-framework-LatentSemanticMapping] [devel/py-pyobjc-framework-InstallerPlugins] [devel/py-pyobjc-framework-PubSub] [devel/py-pyobjc-framework-EventKit] [devel/py-pyobjc-framework-OpenDirectory] [devel/py-pyobjc-framework-AppleScriptKit] [devel/py-pyobjc-framework-ScriptingBridge] [devel/py-pyobjc-framework-ImageCaptureCore] [devel/py-pyobjc-framework-MediaPlayer] [devel/py-pyobjc-framework-GameCenter] [devel/py-pyobjc-framework-MediaAccessibility] [devel/py-pyobjc-framework-Intents] [devel/py-pyobjc-framework-NetFS] [devel/py-pyobjc-framework-Photos] [devel/py-pyobjc-framework-AVKit] [devel/py-pyobjc-framework-MultipeerConnectivity] [devel/py-pyobjc-framework-ApplicationServices] [devel/py-pyobjc-framework-ModelIO] [devel/py-pyobjc-framework-CoreBluetooth] [devel/py-pyobjc-framework-SafariServices] [devel/py-pyobjc-framework-AVFoundation] [devel/py-pyobjc-framework-CloudKit] [devel/py-pyobjc-framework-CoreML] [devel/py-pyobjc-framework-CoreSpotlight] [devel/py-pyobjc-framework-ExternalAccessory] [devel/py-pyobjc-framework-MapKit] [devel/py-pyobjc-framework-MediaLibrary] [devel/py-pyobjc-framework-PhotosUI] [devel/py-pyobjc-framework-SecurityInterface] [devel/py-pyobjc-framework-SpriteKit] [devel/py-pyobjc-framework-iTunesLibrary] [devel/py-pyobjc-framework-IOSurface] [devel/py-pyobjc-framework-NotificationCenter] [devel/py-pyobjc-framework-FinderSync] [devel/py-pyobjc-framework-Vision] [devel/py-pyobjc-framework-SceneKit] [devel/py-pyobjc-framework-LocalAuthentication] [devel/py-pyobjc-framework-GameController] [devel/py-pyobjc-framework-libdispatch] [devel/py-pyobjc-framework-Contacts] [devel/py-pyobjc-framework-ContactsUI] [devel/py-pyobjc-framework-Security] [devel/py-pyobjc-framework-GameKit] [devel/py-pyobjc-framework-CryptoTokenKit] [devel/py-pyobjc-framework-ColorSync] [devel/py-pyobjc-framework-GameplayKit] [devel/py-pyobjc-framework-NetworkExtension] [lang/python37] [devel/py-pyobjc-framework-CoreServices] [devel/py-pyobjc-framework-CoreAudio]

Required to build:
[pkgtools/cwrappers]

Version history: (Expand)


CVS history: (Expand)


   2026-06-03 13:44:18 by Adam Ciarcinski | Files touched by this commit (153) | Package updated
Log message:
py-pyobjc: updated to 12.2

12.2

Update framework bindings for macOS 26.5 SDK

The following code failed at the last line in previous versions:

 class MyObject(NSObject):
     pass

 obj = MyObject()
 obj.alloc = MyObject.alloc
 print(obj.alloc) # Raised AttributeError
Backward incompatible changes: CFBagCreate and CFBagCreateMutable now match the \ 
API in Objective-C, that is, a value for the callbacks argument must be passed \ 
(must be kCFTypeBagCallBacks).

* Fix retain count management for the callbacks registered with \ 
DARegisterDiskEjectApprovalCallback, DARegisterDiskMountApprovalCallback, and \ 
DARegisterDiskUnmountApprovalCallback in DiskArbitration bindings.

“Hidden” instance methods were not hidden when looking them up as an \ 
attribute on the class, but found an unbound method as if the method was not \ 
hidden.

“Hidden” instance methods were visible in dir(SomeClass).

* Fix anObject.methodForSelector_(some_selector) resolving to a class method IMP \ 
when a bound selector object for some_selector is a class attribute.

Fixed some memory leaks on unlikely error paths.

* numbers.Number values are proxies as an NSNumber value.

* the new of Objective-C classes now also support keyword arguments derived from \ 
class selectors of the form valueWithKey1:key2: (with an arbitrary prefix \ 
instead of value).

The following calls are now possible (as examples):

Foundation.NSHost(address="www.python.org"), returns \ 
Foundation.NSHost.hostWithAddress_("www.python.org").

AppKit.NSImage(systemSymbolName="multiply.circle.fill", \ 
accessibilityDescription="multiply icon"), returns \ 
AppKit.NSColor.colorWithSystemSymbolName_accessibilityDescription_("multiply.circle.fill", \ 
"multiply icon").

Add NSMutableData.take_bytes on Python 3.15 to mirror the new bytearray method \ 
of the same name.

Rewrite the construction of objects representing method and function metadata, \ 
this should result in (slightly) less memory usage.

This release gets the testsuite for pyobjc-core to a point where there is \ 
comprehensive test coverage for the entire bridge. All extension modules now \ 
have 100% test coverage according to lcov, although with use for exclusion \ 
comments to ignore code blocks that cannot be reached for various reasons (e.g. \ 
PyDict_New can fail, but that only happens when running out of memory and it not \ 
preproducable during testing).

This enables refactoring the code in pyobjc-core with more confidence that this \ 
won’t result in unexpected changes in behaviour.

Fix error message for invalid argument to a callable with a variable length \ 
output buffer argument.

Fix error handlign for incomplete struct encodings.

Raise better error when specifying a negative array size for (Objective-)C \ 
arguments where the size of a buffer is passed as one of the arguments to a \ 
method or function.

A side effect of this is that a number of manual bindings no longer support \ 
passing -1 as the size of a buffer to derive the size from the Python sequence.

A Python implementation for a method that returns void and has a single output \ 
parameter used to leak a reference to the return value.

Fix crash when a Python implementation with a pass-by-reference output argument \ 
or return value returns an Objective-C instance that is no longer referenced in \ 
Python when the function returns, e.g.:

@objc.objc_method(signature=b"@@:o^@")
def myOutput_(self, a):
    return (1, NSObject.alloc().init())
The bridge could pass a null pointer for a function pointer argument in some \ 
(unlikely) edge cases instead of raising an error.

Fix various crashes related to edge cases in pass-by-reference argument handling \ 
(none of which happen are used in bindings for Cocoa frameworks)

Metadata with a tuple as the value for c_array_length_in_arg for an output \ 
argument is now honored for methods implemented in Python.

Fix crash when c_array_length_in_arg metadata refers to an non-existing argument.

Fix handling of transient proxy value, such as when Objective-C calls a Python \ 
method when the object is kept alive from Objective-C (no active reference in \ 
Python).

Edge case found while debugging an unexpected crash in the free-threaded build \ 
which uncovered a bug that also affected the regular build (but was not \ 
triggered there in the test suite).

aValue.methodForSelector_ now works when the selector is implemented in Python, \ 
the result will be the Python callable (not wrapped in an objc.IMP value).

* A number of constants in the CoreAudio bindings evaluated to byte strings, \ 
while the framework expects regular strings.

Foundation.NSDecimalNumber can no longer be subclassed in Python.

Subclasses was possible in older versions, but this is something that isn’t \ 
supported in Objective-C and has unexpected behaviour.

The cobject and c_void_p arguments for opaque pointer types and objc.objc_object \ 
are now keyword only.

This should not affect user code because passing these values by value isn’t \ 
useful (esp. because the c_void_p argument is the only one that’s useful for \ 
interop with 3th-party code).

* “frozendict” is supported with Python 3.15a7 and later.

Instances roundtrip to Objective-C objects similarly as the dict type, including \ 
for keyed archiving. For non-keyed archiving a frozendict value is read back as \ 
a plain dict.

The metadata method on objc.function, objc.selector, and objc.IMP now returns a \ 
frozendict instead of a regular dict to indicate that changing the value has no \ 
effect.

* Drop GIL when sending KVO notifications

PR by github user Tim Clem.

* Drop dependency on dis.dis

PR by github user Max Bélanger.Update framework bindings for macOS 26.5 SDK
   2025-12-30 15:18:30 by Adam Ciarcinski | Files touched by this commit (155) | Package updated
Log message:
py-pyobjc: updated to 12.1

12.1

12.0 incorrectly has support for Python 3.9 in
packaging metadata.

Update framework bindings for the macOS 26.1 SDK

Instances of :type:bytearray can be used as the argument for
a function or selector that expects a null-terminated C char array.

Automatically disable KVO usage for subclasses of NSProxy defined
in Python.

Fix SystemError when calling objc.propertiesForClass(objc.objc_object).

objc.classAddMethods no longer supports callable's whose __name__
attribute is a byte string.

Clearer error messages when an entry in the methods added with
objc.classAddMethod is invalid.

Using objc.classAddMethods to add a method for which a custom
IMP helper has been registered now works correctly (previously
the default libffi IMP implementation was used in these cases),
and likewise for using :funcsetattr to assign methods.

It is no longer possible to use :func:objc.classAddMethods to
override an existing method with an incompatible Objective-C signature,
and likewise for using :func:setattr to do the same.

It was already not possible to override a method from a super class
with an incompatible Objective-C signature.

It is now possible to use an :class:objc.objc_method instance
in the method list argument for :func:objc.classAddMethod.

-[OC_PythonObject copy] now actually copies the value if the
value is not known to be immutable (such as subclasses of the
builtin number types).
   2025-07-11 11:04:11 by Adam Ciarcinski | Files touched by this commit (302) | Package updated
Log message:
py-pyobjc*: updated to 11.1

11.1

The major change in this release is aligning behaviour of the core bridge
with clang's documentation for automatic reference counting \ 
<https://clang.llvm.org/docs/AutomaticReferenceCounting.html>_
for initializer methods. In particular, PyObjC now correctly models
that methods in the "init" family steal a reference to self and return
a new reference.
   2025-06-18 17:24:47 by Adam Ciarcinski | Files touched by this commit (2)
Log message:
py-pyobjc-core: fix build with older Clang
   2025-04-23 14:45:25 by Adam Ciarcinski | Files touched by this commit (192)
Log message:
py-pyobjc*: fix for setuptools>=78; bump revisions
   2025-02-05 09:05:44 by Adam Ciarcinski | Files touched by this commit (303) | Package updated
Log message:
py-pyobjc: updated to 11.0

Version 11.0
The major change in this release is experimental support for free-threading (PEP \ 
703) which was introduced as an experimental feature in Python 3.13.

This required fairly significant changes in the core of PyObjC to change C \ 
Python API use and PyObjC internal APIs (mostly related to the use of borrowed \ 
references).

Dropped support for Python 3.8. PyObjC 11 supports Python 3.9 and later.

Updated metadata for the macOS 15.2 SDK, including bindings for the following \ 
frameworks:

MediaExtension
DeviceDiscoveryExtension
Added minimal bindings to the Carbon framework.

At this time only some functions and constants related to hotkeys are available. \ 
Please file an issue if you have a usecase for other APIs.

Struct wrappers now support a number of functions from copy: copy.replace() (new \ 
in Python 3.13), copy.copy() and copy.deepcopy().

The __pyobjc_copy__ method has been removed from struct wrappers. This was never \ 
a public API. Use copy.deepcopy() instead.

objc.FSRef.from_path`() now supports os.PathLike values as its arguments (as \ 
well as strings).

Experimental support for the free-threading mode introduced in Python 3.13.

The core bridge and framework bindings claim compatibility with free-threading \ 
as introduced as an experimental feature in Python 3.13.

The support in PyObjC is also an experimental feature: I’ve reviewed code for \ 
free-threading issues and adjusted it where needed, but the code has seen only \ 
light testing w.r.t. concurrency.

Some functionality that’s explicitly not thread-safe:

Defining an Objective-C class with the same name in multiple threads concurrently.

Splitting calls to alloc and init and calling init multiple times concurrently. E.g.:

import threading
from Cocoa import NSObject

v = NSObject.alloc()

t_list = []
for _ in range(2):
    t = threading.Thread(target=lambda: v.init())
    t_list.append(t)
    t.start()

for t in t_list:
    t.join()
The internal mapping from Python values to their active Objective-C proxy value \ 
now uses weak references. This should not affect user code, other than being a \ 
bit more efficient.

The internal interfaces for updating this mapping, and the reverse mapping from \ 
Objective-C values to their active Python proxy was changed to remove a small \ 
race condition. This was required for free threading support, but could in \ 
theory also bit hit when using the GIL.

The data structure for mapping Python values to their Objective-C proxy has been \ 
rewritten to support free threading. This also simplifies the code, and should \ 
be small performance improvement for the regular build of Python.

The TypeError raised when passing a non-sequence value to some APIs implemented \ 
in C now has a __cause__ with more detailed information.

This is a side effect of dropping the use of PySequence_Fast in the \ 
implementation of PyObjC.

Removed objc.options._nscoding_version, a private option that is no longer used.

Changing the __block_signature__ of a block value when the current value of the \ 
signature is not None is no longer possible.

Please file an issue if you have a use case for changing the signature of a block.

Fix compatibility with Python 3.14 (alpha 3)

Removed private function objc._sizeOfType because its unused.

Fix memory leak when using Python callables as blocks.

The memory leak also resulted in leaking a reference to the callable (and hence \ 
anything kept alive by that reference).

The generic __new__ implementation now works as intended when registering \ 
methods that other than init... methods.

Dropped ‘%n’ support in handling printf-format strings for variadic \ 
functions and methods.

Two reasons for that: 1) supporting this properly should return the value \ 
writing to the %n location (requiring significant changes) and 2) Apple’s \ 
libraries require using static strings for ‘%n’ to work (at least on some \ 
platforms and versions of the OS)

Fix manual bindings for AVAudioPCMBuffer methods for getting channel data \ 
(floatChannelData, int16ChannelData and int32ChannelData)

fix broken bindings for CGWindowListCreateImageFromArray.

The private __is_magic attribute on objc.objc_object has been renamed to \ 
__pyobjc_magic_coookie__.

Various fixes to edge case behaviour that were found while improving test coverage.
   2024-11-11 08:29:31 by Thomas Klausner | Files touched by this commit (862)
Log message:
py-*: remove unused tool dependency

py-setuptools includes the py-wheel functionality nowadays
   2024-06-11 18:10:28 by Adam Ciarcinski | Files touched by this commit (150) | Package updated
Log message:
py-pyobjc*: updated to 10.3.1

Version 10.3.1

Ensure __init__ can be used when user implements __new__.

Version 10.3 dropped support for calling __init__, but that breaks a number of \ 
popular projects. Reintroduce the ability to use __init__ when a class or one of \ 
its super classes contains a user implemenentation of __new__.

Code relying on the __new__ provided by PyObjC still cannot use __init__ for the \ 
reason explained in the 10.3 release notes.