{"library":"pyobjc-framework-datadetection","title":"PyObjC DataDetection Framework","description":"PyObjC is a bridge between Python and the Objective-C runtime, allowing Python scripts to interact with macOS frameworks. `pyobjc-framework-datadetection` provides Python bindings for the DataDetection framework on macOS, enabling programmatic detection of data such as phone numbers, dates, and addresses in text. The current version is 12.1, with releases typically aligning with new macOS SDKs and Python versions.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-datadetection"],"cli":null},"imports":["from DataDetection import DDScanner","from DataDetection import DDConditionIsPhoneNumber","from DataDetection import DDScannerResult","from Foundation import NSString"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from DataDetection import DDScanner, DDConditionIsPhoneNumber, DDConditionIsDate, DDConditionIsEmail\nfrom Foundation import NSString # Can be used for explicit Objective-C string creation, though Python strings often bridge automatically\n\n# Constants for content types (exposed directly from the DataDetection module)\nPHONE_NUMBER = DDConditionIsPhoneNumber\nDATE = DDConditionIsDate\nEMAIL = DDConditionIsEmail\n\ntext = \"My phone number is 123-456-7890 and the date is January 15, 2024. Email me at test@example.com.\"\n\n# Create a scanner for phone numbers, dates, and emails\n# The | operator is used to combine multiple conditions\nscanner = DDScanner.scannerWithContentTypes_(PHONE_NUMBER | DATE | EMAIL)\n\n# Scan the string\n# PyObjC automatically converts Python strings to NSString for Objective-C APIs\nresults = scanner.scanString_(text)\n\nprint(f\"Scanning text: '{text}'\")\nprint(\"Found results:\")\nfor result in results:\n    print(f\"  Matched String: '{result.matchedString()}'\")\n    print(f\"    Type (raw): {result.type()}\") # Raw Objective-C type constant\n    # The 'value()' method returns an Objective-C object specific to the detected type\n    if result.type() == PHONE_NUMBER:\n        print(f\"    Value (Phone Number): {result.value()}\")\n    elif result.type() == DATE:\n        print(f\"    Value (Date): {result.value()}\")\n    elif result.type() == EMAIL:\n        print(f\"    Value (Email): {result.value()}\")\n","lang":"python","description":"This quickstart demonstrates how to use `DDScanner` to detect phone numbers, dates, and email addresses in a given string. It combines multiple detection conditions using the bitwise OR operator (`|`) and then iterates through the `DDScannerResult` objects to extract matched strings and their specific values.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":null,"pypi_latest":"12.1","is_stale":null,"summary":{"python_range":"3.10–3.9","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.2,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.2,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.1,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.7,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyobjc-framework-datadetection","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.9,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}