{"library":"pyobjc-framework-photos","title":"PyObjC Framework Photos","description":"This library provides Python wrappers for the Photos framework on macOS, allowing Python applications to interact with the user's photo library. It's part of the larger PyObjC project, enabling access to Objective-C frameworks from Python. The current version is 12.1 and follows the PyObjC project's release cadence, often aligning with macOS SDK updates and Python version support.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-photos"],"cli":null},"imports":["import Photos","import objc"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import Photos\nimport objc\n\ndef list_some_photo_data():\n    # All Cocoa calls must be made within an autorelease pool\n    pool = objc.autorelease_pool()\n    try:\n        # Check authorization status for Photos access\n        status = Photos.PHPhotoLibrary.authorizationStatus()\n\n        if status == Photos.PHAuthorizationStatusAuthorized:\n            print(\"Photos access is authorized.\")\n            \n            # Fetch all user albums\n            user_albums = Photos.PHAssetCollection.fetchAssetCollectionsWithType_subtype_options_(\n                Photos.PHAssetCollectionTypeAlbum,\n                Photos.PHAssetCollectionSubtypeAny,\n                None\n            )\n            print(f\"Found {user_albums.count()} user albums:\")\n            for i in range(min(3, user_albums.count())): # List up to 3 albums\n                album = user_albums.objectAtIndex_(i)\n                print(f\"- {album.localizedTitle()}\")\n        elif status == Photos.PHAuthorizationStatusLimited:\n            print(\"Photos access is limited (user selected specific photos).\")\n            # Can still fetch, but only for selected photos\n        else:\n            print(f\"Photos access is not authorized. Current status: {status}\")\n            print(\"Please ensure your application (or terminal) has Photos access granted in System Settings > Privacy & Security > Photos.\")\n    finally:\n        # The pool must be released\n        del pool\n\nif __name__ == '__main__':\n    list_some_photo_data()","lang":"python","description":"This quickstart demonstrates how to check Photos library authorization and list the titles of a few user-created albums. This code must be run on macOS. You might need to grant your Python environment (e.g., Terminal.app or your IDE) access to Photos via System Settings > Privacy & Security > Photos.","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-photos","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-photos","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.9,"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-photos","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-photos","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3,"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-photos","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-photos","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.8,"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-photos","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-photos","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.5,"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-photos","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-photos","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.6,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}