Registry / type-stubs / pyobjc-framework-linkpresentation

pyobjc-framework-linkpresentation

JSON →
library12.2pypypiunverified

PyObjC is a bridge between Python and Objective-C, enabling Python scripts to interact with macOS Cocoa frameworks. This specific package, `pyobjc-framework-linkpresentation`, provides Python wrappers for Apple's LinkPresentation framework on macOS, allowing developers to fetch and present rich link previews from URLs. It is actively maintained with regular releases, currently at version 12.1.

pip install pyobjc-framework-linkpresentation
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-L
P
pyobjc-framework-linkpresentation
type-stubspythonv12.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.

LinkPresentation
import LinkPresentation
Framework classes, functions, and constants are exposed directly under the framework's package name.

This quickstart demonstrates how to fetch rich link metadata from a URL using `LPMetadataProvider` and how to create custom `LPLinkMetadata` objects. It includes a mechanism to handle the asynchronous nature of `startFetchingMetadataForURL_completionHandler_` using a `threading.Event` to wait for the Objective-C callback.

import LinkPresentation import Foundation import objc import threading # Use a threading.Event to signal when the metadata fetching is complete done_fetching = threading.Event() metadata_result = None error_result = None def completion_handler(metadata, error): global metadata_result, error_result metadata_result = metadata error_result = error done_fetching.set() # Signal that fetching is done @objc.python_block def py_completion_handler(metadata, error): completion_handler(metadata, error) def fetch_link_metadata(url_string): global metadata_result, error_result metadata_result = None error_result = None done_fetching.clear() url = Foundation.NSURL.URLWithString_(url_string) if not url: print(f"Invalid URL: {url_string}") return provider = LinkPresentation.LPMetadataProvider.alloc().init() provider.startFetchingMetadataForURL_completionHandler_(url, py_completion_handler) # Wait for the completion handler to be called print(f"Fetching metadata for {url_string}...") if not done_fetching.wait(timeout=10): # Wait up to 10 seconds print("Fetching timed out.") return if error_result: print(f"Error fetching metadata: {error_result}") elif metadata_result: print("Metadata fetched successfully:") print(f" Title: {metadata_result.title()}") print(f" URL: {metadata_result.URL()}") else: print("No metadata or error received.") if __name__ == "__main__": # Fetch metadata for a remote URL test_url = os.environ.get('TEST_URL', 'https://www.apple.com') fetch_link_metadata(test_url) # Create and inspect custom metadata print("\nCreating custom metadata:") custom_metadata = LinkPresentation.LPLinkMetadata.alloc().init() custom_metadata.setOriginalURL_(Foundation.NSURL.URLWithString_("https://example.com/custom")) custom_metadata.setURL_(Foundation.NSURL.URLWithString_("https://example.com/custom")) custom_metadata.setTitle_("My Custom Link Title") print(f" Title: {custom_metadata.title()}") print(f" URL: {custom_metadata.URL()}")
Debug
Known issues
breakingPyObjC v12.0 dropped support for Python 3.9. Projects targeting older Python versions must use an older PyObjC release (e.g., v11.x for Python 3.9).
fix
Upgrade to Python 3.10 or newer, or pin `pyobjc` to `<12.0`.
affects: >=12.0
breakingPyObjC v11.0 dropped support for Python 3.8. Projects targeting Python 3.8 must use an older PyObjC release (e.g., v10.x).
fix
Upgrade to Python 3.9 or newer, or pin `pyobjc` to `<11.0`.
affects: >=11.0
gotchaThe behavior of `__init__` and `__new__` for Python subclasses of Objective-C classes changed in v10.3 and was partially reverted in v10.3.1. If you implement `__new__` in a Python subclass, you must ensure `__init__` is callable, which was broken in 10.3. If using PyObjC's provided `__new__`, `__init__` is still not supported.
fix
Review Python subclass implementations, especially for custom `__new__` methods. Ensure compatibility with `__init__` expectations based on your PyObjC version.
affects: 10.3, 10.3.1
breakingPyObjC v11.1 aligned its reference counting for initializer methods (e.g., `init` family) with clang's Automatic Reference Counting (ARC) documentation. Methods in the 'init' family now correctly steal a reference to `self` and return a new reference, which might change behavior if your code relied on previous PyObjC reference counting semantics.
fix
Review code interacting with Objective-C initializer methods to ensure correct reference counting, especially in manual memory management scenarios or when bridging complex ownership patterns.
affects: >=11.1
deprecatedThe `IMServicePlugIn` framework bindings were removed in PyObjC v10.0, as the framework itself was deprecated in macOS 10.13 and removed in macOS 14.
fix
Update applications to use modern macOS communication APIs, as `IMServicePlugIn` is no longer available on recent macOS versions or in PyObjC.
affects: >=10.0
gotchaPyObjC v11.0 introduced experimental support for free-threading (PEP 703) with Python 3.13. While this is a significant feature, it's experimental and might not be stable for all use cases, requiring careful testing in multi-threaded environments.
fix
Exercise caution when using PyObjC in a free-threaded Python 3.13+ environment. Monitor for unexpected behavior related to concurrency and reference handling.
affects: >=11.0 (with Python 3.13+)
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredFundamental bridge between Python and Objective-C; required by all PyObjC framework bindings.
pyobjc-framework-FoundationoptionalProvides core macOS classes like NSURL, frequently used when interacting with LinkPresentation objects.
Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
4
Resources
pyobjc-framework-linkpresentation — pip install pyobjc-framework-linkpresentation · libregistry