Registry / ai-ml / pyobjc-framework-gameplaykit

pyobjc-framework-gameplaykit

JSON →
library12.2pypypiunverified

PyObjC-framework-gameplaykit provides Python bindings for Apple's GameplayKit framework on macOS. It enables Python applications to leverage game development utilities, including random number generation, pathfinding, AI behaviors, and more, directly from Python. The current version is 12.1, with releases generally aligning with macOS SDK updates.

pip install pyobjc-framework-gameplaykit
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-G
P
pyobjc-framework-gameplaykit
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.

GameplayKit
import GameplayKit
GKRandomSource
from GameplayKit import GKRandomSource

This quickstart demonstrates how to import and use a basic GameplayKit feature, `GKARC4RandomSource`, to generate random numbers and shuffle arrays. It highlights the `alloc().init()` pattern for Objective-C object instantiation via PyObjC.

import GameplayKit import objc # For general PyObjC operations, though not explicitly used here beyond object instantiation # Initialize a basic random number generator from GameplayKit # The alloc().init() pattern is common for Objective-C object creation random_source = GameplayKit.GKARC4RandomSource.alloc().init() # Generate a random integer within a bound (0 to 99) random_int = random_source.nextIntWithUpperBound_(100) print(f"Generated random number (0-99): {random_int}") # Example using a different random distribution shuffled_array = random_source.arrayByShufflingObjectsInArray_(["apple", "banana", "cherry", "date"]) print(f"Shuffled array: {shuffled_array}")
Debug
Known issues
breakingPyObjC 12.0 dropped support for Python 3.9, and PyObjC 11.0 dropped support for Python 3.8. Users upgrading should ensure their Python environment meets the new minimum requirement (currently Python 3.10+).
fix
Upgrade to Python 3.10 or newer, or pin pyobjc-framework-gameplaykit to an older version compatible with your Python environment.
affects: >=11.0, >=12.0
gotchaPyObjC 11.1 changed how initializer methods (like `init`) handle reference counting, aligning with `clang`'s ARC documentation. Methods in the 'init' family now correctly steal a reference to `self` and return a new one. This could subtly affect memory management or object lifecycle in applications directly interacting with low-level Objective-C object creation.
fix
Review code that directly calls `alloc().init()` or other `init` family methods, especially if custom memory management or unusual object lifecycles are involved. Most high-level usage should be unaffected.
affects: >=11.1
gotchaExperimental free-threading support (PEP 703) in Python 3.13 is *not fully stable or supported* in PyObjC 11. While changes were made to enable it, relying on it for production or performance-critical applications is not recommended.
fix
Avoid using PyObjC with Python 3.13's experimental free-threading features until explicitly announced as stable. If free-threading is critical, consider using PyObjC 12.x or later with a Python version where free-threading is stable, or use traditional threading models.
affects: >=11.0, <12.0 (for Python 3.13)
gotchaIn PyObjC 10.3, direct calls to `__init__` were restricted when a class used PyObjC's `__new__` implementation. Version 10.3.1 reintroduced the ability to use `__init__` if the user provided their own `__new__` or a superclass did. Code relying on PyObjC's default `__new__` still cannot use `__init__`.
fix
If experiencing issues with `__init__` not being called, ensure your class or its superclasses provide a custom `__new__` if you intend to use `__init__`. Otherwise, adapt your object initialization to Objective-C patterns (e.g., using factory methods or designated initializers).
affects: 10.3.x
gotchaThe `os.fspath()` function in Python will raise a `TypeError` when used with Cocoa URLs (`NSURL`, `CFURLRef`) that do not refer to local filesystem paths (e.g., web URLs). This change in behavior ensures `os.fspath()` correctly reflects only local filesystem paths.
fix
If you need to work with `NSURL` objects that might not represent local filesystem paths, avoid `os.fspath()`. Use `NSURL`'s methods (e.g., `absoluteString()`, `path()`) or convert to a Python string explicitly, verifying it's a local path first if needed.
affects: >=10.1
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredCore bridge between Python and Objective-C frameworks.
Agent activity
11 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
pyobjc-framework-gameplaykit — pip install pyobjc-framework-gameplaykit · libregistry