{"library":"pyobjc-framework-backgroundassets","title":"PyObjC Framework: BackgroundAssets","description":"Python wrappers for the macOS BackgroundAssets framework, enabling applications to manage large asset downloads in the background. It is part of the comprehensive PyObjC project, which provides Python bindings for the entire macOS and iOS Cocoa frameworks. Version 12.1 is the latest stable release, with updates typically aligned with macOS SDK releases and Python version support.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-backgroundassets"],"cli":null},"imports":["from BackgroundAssets import BAManager","from BackgroundAssets import BAURLDownload","from BackgroundAssets import BAURLDownloadConfiguration","import Foundation"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import Foundation\nfrom BackgroundAssets import BAManager, BAURLDownload, BAURLDownloadConfiguration, BAURLDownloadNetworkActivityCellular\n\n# Get the shared manager instance\nmanager = BAManager.sharedManager()\n\n# Create a configuration for the download\nconfig = BAURLDownloadConfiguration.new()\nconfig.setIdentifier_(\"com.example.mybackgrounddownload\") # Unique identifier\nconfig.setDiscretionary_(True) # Allow system to decide when to run\nconfig.setRequiresPower_(False) # Does not require external power\nconfig.setRequiresNetworkActivity_(BAURLDownloadNetworkActivityCellular) # Or BAURLDownloadNetworkActivityAny, BAURLDownloadNetworkActivityWiFi\n\n# Create a URL for the download (replace with a real URL for testing)\ndownload_url_str = \"https://example.com/some/large/file.zip\"\ndownload_url = Foundation.NSURL.URLWithString_(download_url_str)\n\n# Create the download object\n# The last argument is an NSError** pointer; use None for Python in non-error cases\ndownload, error = BAURLDownload.downloadWithURL_configuration_error_(download_url, config, None)\n\nif download:\n    print(f\"Successfully created BAURLDownload: {download.identifier()}\")\n    print(f\"Download URL: {download.URL().absoluteString()}\")\n    print(f\"Configuration identifier: {download.configuration().identifier()}\")\n    \n    # To actually schedule it, you'd add it to the manager. This often requires\n    # specific macOS entitlements and an application lifecycle.\n    # For a simple runnable snippet, just creating the objects is sufficient.\n    # success, error_add = manager.addDownload_error_(download, None)\n    # if success: print(f\"Added download to manager.\")\n    # else: print(f\"Failed to add download: {error_add}\")\nelse:\n    print(f\"Failed to create BAURLDownload: {error}\")","lang":"python","description":"This example demonstrates how to create a `BAURLDownloadConfiguration` and a `BAURLDownload` object using the `BackgroundAssets` framework. Note that actually initiating and managing background downloads requires specific macOS application entitlements and a properly configured application delegate, which are outside the scope of a simple Python script.","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-backgroundassets","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-backgroundassets","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-backgroundassets","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-backgroundassets","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-backgroundassets","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-backgroundassets","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-backgroundassets","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-backgroundassets","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-backgroundassets","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-backgroundassets","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.5,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}