Registry / aws / pyobjc-framework-speech

pyobjc-framework-speech

JSON →
library12.2pypypiunverified

PyObjC-framework-Speech provides Python wrappers for the macOS Speech framework, enabling features like speech recognition. It's part of the PyObjC project, which bridges Python and Objective-C, and typically updates alongside macOS SDK releases, ensuring compatibility with the latest system features.

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

SFSpeechRecognizer
from Speech import SFSpeechRecognizer
SFSpeechRecognitionRequest
from Speech import SFSpeechRecognitionRequest
SFSpeechRecognizerAuthorizationStatusAuthorized
from Speech import SFSpeechRecognizerAuthorizationStatusAuthorized
NSLocale
from Foundation import NSLocale

Checks the authorization status for speech recognition, requests it if not determined, and then initializes an `SFSpeechRecognizer` to check its availability and supported locales. Note that a full PyObjC application typically runs within an event loop to handle UI interactions and asynchronous callbacks properly. Running this script directly will trigger the permission dialog, but a `PyObjCTools.AppHelper.runConsoleEventLoop` might be needed for the callback to be fully processed if the script exits too quickly.

import objc from Foundation import NSLog, NSLocale from Speech import SFSpeechRecognizer, SFSpeechRecognizerAuthorizationStatusAuthorized, SFSpeechRecognizerAuthorizationStatusNotDetermined def check_speech_recognizer_availability(): # Check authorization status status = SFSpeechRecognizer.authorizationStatus() if status == SFSpeechRecognizerAuthorizationStatusNotDetermined: NSLog("Speech recognition authorization status: Not Determined. Requesting access...") # This will present a permission dialog to the user. The callback will be invoked. # In a full app, you'd handle the response asynchronously. SFSpeechRecognizer.requestAuthorization_(lambda new_status: NSLog(f"New authorization status: {new_status}")) elif status != SFSpeechRecognizerAuthorizationStatusAuthorized: NSLog(f"Speech recognition authorization denied or restricted: {status}") return # Create a recognizer for the default locale recognizer = SFSpeechRecognizer.alloc().init() if recognizer: NSLog(f"SFSpeechRecognizer available: {recognizer.isAvailable()}") NSLog(f"Supported locales: {[locale.localeIdentifier() for locale in recognizer.supportedLocales()]}") else: NSLog("Failed to create SFSpeechRecognizer. Ensure device supports speech recognition.") if __name__ == "__main__": # For permission requests to fully process and callbacks to fire reliably in a script, # a Cocoa event loop is often necessary. check_speech_recognizer_availability() # For interactive scripts, uncomment the following lines to run a small event loop: # from PyObjCTools import AppHelper # AppHelper.runConsoleEventLoop(installInterrupt=True)
Debug
Known issues
breakingPyObjC 12.0 dropped support for Python 3.9. PyObjC 11.0 dropped support for Python 3.8. Users must use newer Python versions to install and run these PyObjC releases.
fix
Upgrade to Python 3.10 or newer (Python 3.13 is supported by recent PyObjC releases, with experimental free-threading).
affects: 11.0, 12.0+
gotchaUsing the macOS Speech framework (and many other macOS frameworks) requires explicit user permissions (e.g., microphone access, speech recognition). Your application must request these permissions, and users must grant them.
fix
Implement `SFSpeechRecognizer.requestAuthorization_` and handle its callback. Crucially, ensure your app's `Info.plist` (for bundled apps) includes `NSSpeechRecognitionUsageDescription` and `NSMicrophoneUsageDescription` keys with descriptive strings.
affects: all
breakingPyObjC 12.0 introduced a significant change by splitting the `AVFAudio` bindings into their own top-level package, instead of being merged into `AVFoundation`. While `pyobjc-framework-speech` imports directly from `Speech`, projects using multiple PyObjC bindings, especially those involving audio, might be affected.
fix
Update imports from `AVFoundation` to `AVFAudio` for specific audio components. Ensure `pyobjc-framework-AVFoundation` is installed if you need the `AVFAudio` components (it is included in that distribution).
affects: 12.0+
gotchaPyObjC 11.1 aligned its core bridge behavior with clang's Automatic Reference Counting (ARC) documentation for initializer methods. This means methods in the 'init' family now correctly steal a reference to self and return a new one, which might change memory management expectations for advanced users interacting directly with Objective-C object lifecycles.
fix
Review memory management patterns, especially around object creation and initialization, for code interacting deeply with Objective-C objects via `alloc().init()` and similar patterns.
affects: 11.1+
gotchaSpeech recognition with `SFSpeechRecognizer` is an inherently asynchronous process using delegates and callbacks, which is different from typical synchronous Python APIs. Proper handling often requires running within a Cocoa event loop.
fix
Familiarize yourself with Cocoa's delegate pattern. For command-line tools or scripts, consider using `PyObjCTools.AppHelper.runConsoleEventLoop()` to ensure callbacks are processed and permission dialogs are handled correctly.
affects: all
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredPyObjC-framework-Speech is a binding for a macOS framework and requires the core PyObjC bridge to function.
Agent activity
11 hits · last 30 days
node
10
Resources
pyobjc-framework-speech — pip install pyobjc-framework-speech · libregistry