{"library":"pyobjc-framework-cfnetwork","title":"PyObjC CFNetwork Framework Bindings","description":"PyObjC provides Python bindings for Apple's macOS frameworks, allowing Python applications to interact with Objective-C APIs. The `pyobjc-framework-cfnetwork` package specifically provides wrappers for the CFNetwork framework, which offers a C-based API for low-level network services. It is actively maintained as part of the broader PyObjC project, with releases often coinciding with new macOS SDK updates and Python version support. The current version is 12.1.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyobjc-framework-cfnetwork"],"cli":null},"imports":["import CFNetwork"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import CFNetwork\n\n# Create a CFHost object for a given hostname\nhostname = \"www.apple.com\"\nhost = CFNetwork.CFHostCreateWithName(None, hostname)\n\nif host:\n    # Start info resolution (blocking for simplicity; real apps might use async)\n    # kCFHostAddresses resolves IP addresses\n    success = CFNetwork.CFHostStartInfoResolution(\n        host, CFNetwork.kCFHostAddresses, None\n    )\n    if success:\n        # Retrieve the resolved addresses\n        # PyObjC automatically converts CFArrayRef to Python list\n        addresses = CFNetwork.CFHostGetAddressing(host, None)\n        if addresses:\n            print(f\"Resolved addresses for {hostname}:\")\n            for address in addresses:\n                # address is a CFDataRef containing sockaddr_storage\n                print(f\"  {address}\") \n        else:\n            print(f\"No addresses found for {hostname}\")\n    else:\n        print(f\"Failed to resolve host {hostname}\")\n    \n    # Stop resolution and release resources (PyObjC handles Python object lifecycle)\n    CFNetwork.CFHostStopInfoResolution(host)\nelse:\n    print(f\"Failed to create CFHost object for {hostname}\")","lang":"python","description":"This example demonstrates how to use `CFNetwork.CFHostCreateWithName` to create a host object and then resolve its IP addresses. It showcases basic interaction with a C-based macOS networking API through PyObjC.","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-cfnetwork","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-cfnetwork","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-cfnetwork","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-cfnetwork","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-cfnetwork","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-cfnetwork","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-cfnetwork","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-cfnetwork","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":2.6,"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-cfnetwork","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-cfnetwork","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":3.4,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}