Registry /
serialization / pyobjc-framework-dictionaryservices
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
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DCSCopyTextDefinition
✓ from CoreServices import DCSCopyTextDefinition
✗ from DictionaryServices import DCSCopyTextDefinition
While 'DictionaryServices' can sometimes be imported directly, the PyObjC documentation states that these bindings are accessed through the 'CoreServices' package.
CFRange
✓ from CoreServices import CFRange
✗ from DictionaryServices import CFRange
CFRange is a CoreFoundation type often used with DictionaryServices, and is available via 'CoreServices'.
This example demonstrates how to use the macOS DictionaryServices framework via PyObjC to look up the definition of a word. It uses `DCSCopyTextDefinition` which is accessed through the `CoreServices` package.
import Foundation
import CoreServices
import objc
word = "recursive"
# Create a CFStringRef from a Python string
string_ref = Foundation.CFString.stringWithString_(word)
# Define a range covering the entire string
full_range = CoreServices.CFRange(0, len(word))
# Look up the definition using DCSCopyTextDefinition
definition_ref = CoreServices.DCSCopyTextDefinition(string_ref, full_range)
if definition_ref:
# Convert CFStringRef to Python string and print
definition = str(definition_ref)
print(f"Definition of '{word}':\n{definition}")
# Release the CFStringRef returned by DCSCopyTextDefinition (retained by 'Copy')
Foundation.CFRelease(definition_ref)
else:
print(f"No definition found for '{word}'.")
# Release the input CFStringRef
Foundation.CFRelease(string_ref)
Debug
Known issues
deprecatedThe underlying macOS DictionaryServices framework is deprecated by Apple. The PyPI page for this package recommends using the 'CoreServices' package instead for modern development. While the PyObjC bindings are still maintained, users should be aware of the upstream deprecation.fixConsider migrating to functionality within the `pyobjc-framework-coreservices` package or other system APIs where applicable.
affects: All versions (upstream Apple deprecation)
breakingPyObjC frequently drops support for older Python versions with major releases. For instance, PyObjC 12.0 dropped support for Python 3.9, and PyObjC 11.0 dropped support for Python 3.8.fixEnsure your Python environment meets the `requires_python` specification (currently >=3.10) for the PyObjC version you are using. Always check release notes before upgrading PyObjC.
affects: 11.0+
gotchaChanges in the handling of `__init__` when a class implements `__new__` were introduced in PyObjC 10.3, leading to breaks in some projects. While partially reverted in 10.3.1 to allow `__init__` usage in certain scenarios, this remains a potential issue for custom Objective-C classes in Python.fixReview PyObjC release notes for 10.3 and 10.3.1 if encountering issues with custom class initialization. In some cases, `__init__` might not be called if `__new__` is handled by PyObjC's internal mechanisms.
affects: 10.3, 10.3.1
breakingPyObjC 11.1 aligned its behavior for initializer methods (those in the 'init' family) with Clang's Automatic Reference Counting (ARC) documentation. This means PyObjC now correctly models that 'init' methods steal a reference to `self` and return a new reference, which can change reference counting behavior.fixCode that manually manages Objective-C object references (e.g., calling `retain` or `release` explicitly) around 'init' methods might need adjustment to conform to the new ARC-aligned behavior.
affects: 11.1+
gotchaUsing the DictionaryServices framework on macOS 10.12 with a `python.org` binary has been known to cause interpreter crashes.fixAvoid using DictionaryServices on macOS 10.12 with `python.org` binaries. Consider using a different Python distribution (e.g., Homebrew) or a newer macOS version if this functionality is critical.
affects: macOS 10.12 (with python.org binaries)
gotchaPrior to PyObjC 10.1, `os.fspath()` would not work correctly with Cocoa URLs (`NSURL`, `CFURLRef`) that refer to local filesystem paths, raising a `TypeError` for other URLs. This was fixed to enable regular Python filesystem APIs with such URLs.fixUpgrade to PyObjC 10.1 or later to ensure `os.fspath()` correctly handles Cocoa URLs for local filesystem paths.
affects: <10.1
gotchaInstances of `bytearray` can now be used as arguments for functions or selectors expecting a null-terminated C `char` array. This is a behavioral change that might affect existing code relying on previous type handling.fixReview code passing `bytearray` to C `char` array arguments to ensure the new implicit conversion behavior is as expected.
affects: 12.1+
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredProvides the core bridge between Python and Objective-C, required by all PyObjC framework bindings.
pyobjc-framework-coreservicesrequiredThe DictionaryServices framework bindings are primarily accessed through the CoreServices package, and the underlying framework is suggested to be used via CoreServices.