Registry / communication / pyobjc-framework-applescriptkit

pyobjc-framework-applescriptkit

JSON →
library12.2.2pypypiunverified

This library provides Python wrappers for the AppleScriptKit framework on macOS, allowing Python applications to embed, compile, and execute AppleScript code. It's part of the larger PyObjC project, which maintains a fairly active release cadence, typically releasing minor updates monthly/bi-monthly and major versions annually following macOS SDK updates. The current version is 12.1.

pip install pyobjc-framework-applescriptkit
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-A
P
pyobjc-framework-applescriptkit
communicationpythonv12.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.95 runs
build_error
glibc
py 3.103.95 runs
build_error
Code
Verified usage

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

AppleScriptKit
import AppleScriptKit
Framework symbols are typically imported directly at the top level after installation.
ASAppleScript
from AppleScriptKit import ASAppleScript
Specific classes within the framework can be imported directly if preferred.

This quickstart demonstrates how to initialize and execute a simple AppleScript string using the `AppleScriptKit` framework. It shows the typical pattern of allocating an Objective-C object, calling an initializer, and handling potential errors.

import AppleScriptKit import Foundation # For common Objective-C types like NSError # Define a simple AppleScript script_source = ''' display dialog "Hello from PyObjC AppleScriptKit!" return "Script executed successfully." ''' # Create an ASAppleScript instance # Note: In PyObjC, None is used for 'nil' or 'NULL' in Objective-C error_ptr = None # We'll pass None and check the returned tuple for errors script = AppleScriptKit.ASAppleScript.alloc().initWithSource_error_(script_source, error_ptr) if script: # Execute the script result, error = script.executeAndReturnError_(error_ptr) if error: print(f"Error executing script: {error.localizedDescription()}") elif result: print(f"Script result: {result.stringValue()}") else: print("Script executed, no result or error reported.") else: print("Failed to initialize ASAppleScript object.")
Debug
Known issues
breakingPython 3.9 and earlier are no longer supported by recent PyObjC versions. PyObjC 12.0 dropped support for Python 3.9, and PyObjC 11.0 dropped support for Python 3.8. Ensure your environment meets the `requires_python` spec (currently `>=3.10`).
fix
Upgrade to Python 3.10 or newer, or use an older PyObjC version (not recommended).
affects: >=11.0
breakingPyObjC 11.1 aligned its behavior for initializer methods (e.g., `init` family methods) with `clang`'s Automatic Reference Counting (ARC) documentation. This change affects how references to `self` are handled and returned, potentially altering memory management in custom Objective-C classes implemented in Python.
fix
Review custom Objective-C classes implemented in Python, especially `init` methods, for potential changes in reference counting behavior. Consult `clang`'s ARC documentation.
affects: >=11.1
gotchaPyObjC (and therefore `pyobjc-framework-applescriptkit`) is exclusively for macOS. It relies heavily on macOS-specific Objective-C frameworks and the Cocoa bridge.
fix
This library is not portable to other operating systems like Windows or Linux. Use platform-specific solutions for cross-platform applications.
affects: All
gotchaPyObjC 11 introduced *experimental* support for free-threading (PEP 703) in Python 3.13. While progress has been made, users attempting to leverage free-threading might still encounter stability issues or unexpected behavior due to the complexity of the Objective-C runtime interacting with Python's new threading model.
fix
If encountering issues with free-threading, consider running without `PYTHON_GIL=0` (i.e., with the GIL enabled) or sticking to an older Python version until free-threading support is more mature in PyObjC.
affects: 11.0 - 12.x (with Python 3.13+)
breakingOlder frameworks or bindings may be removed in major releases. For example, PyObjC 10.0 removed the `IMServicePlugIn` bindings as the framework was deprecated in macOS 10.13 and removed in macOS 14. Always check release notes for framework removals when upgrading major versions.
fix
Consult the release notes for `pyobjc` and specific framework packages when upgrading major versions to identify removed or deprecated bindings.
affects: >=10.0
Upgrade
Version history
12.2.2latest on PyPI · released Aug 11, 2026
Audit
Dependencies
pyobjc-corerequiredProvides the core bridge between Python and Objective-C, essential for all PyObjC framework bindings.
pyobjc-framework-FoundationoptionalMany macOS frameworks, including AppleScriptKit, rely on fundamental classes from the Foundation framework (e.g., NSString, NSError), which are implicitly used.
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
pyobjc-framework-applescriptkit — pip install pyobjc-framework-applescriptkit · libregistry