Registry / http-networking / pyobjc-framework-cfnetwork

pyobjc-framework-cfnetwork

JSON →
library12.2.2pypypiunverified

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.

pip install pyobjc-framework-cfnetwork
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-C
P
pyobjc-framework-cfnetwork
http-networkingpythonv12.2.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.95 runs
build_error
glibc
py 3.103.95 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CFNetwork
import CFNetwork

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.

import CFNetwork # Create a CFHost object for a given hostname hostname = "www.apple.com" host = CFNetwork.CFHostCreateWithName(None, hostname) if host: # Start info resolution (blocking for simplicity; real apps might use async) # kCFHostAddresses resolves IP addresses success = CFNetwork.CFHostStartInfoResolution( host, CFNetwork.kCFHostAddresses, None ) if success: # Retrieve the resolved addresses # PyObjC automatically converts CFArrayRef to Python list addresses = CFNetwork.CFHostGetAddressing(host, None) if addresses: print(f"Resolved addresses for {hostname}:") for address in addresses: # address is a CFDataRef containing sockaddr_storage print(f" {address}") else: print(f"No addresses found for {hostname}") else: print(f"Failed to resolve host {hostname}") # Stop resolution and release resources (PyObjC handles Python object lifecycle) CFNetwork.CFHostStopInfoResolution(host) else: print(f"Failed to create CFHost object for {hostname}")
Debug
Known issues
breakingPython 3.9 support was dropped in PyObjC 12.0. Python 3.8 support was dropped in PyObjC 11.0.
fix
Ensure your project targets Python 3.10 or later when using PyObjC 12.x, and Python 3.9 or later when using PyObjC 11.x.
affects: 12.0+
breakingPyObjC 11.1 introduced changes to correctly model Automatic Reference Counting (ARC) for initializer methods (e.g., methods in the 'init' family). This aligns with `clang`'s documentation, where initializers steal a reference to `self` and return a new one.
fix
Review code that interacts with `alloc`/`init` patterns for potential memory management issues, although Python's GC often mitigates direct impact unless complex manual reference counting is involved.
affects: 11.1+
gotchaExperimental support for free-threading (PEP 703) in Python 3.13 and later is *not yet fully supported* or stable in PyObjC, despite PyObjC 11.0 introducing *experimental* changes related to it.
fix
Avoid using free-threaded Python builds (e.g., `python --enable-thread-gil=0`) with PyObjC until full, stable support is officially announced to prevent crashes or incorrect behavior.
affects: 11.0+
gotchaThe behavior of `__init__` when a custom `__new__` is implemented changed in PyObjC 10.3, potentially breaking existing code. While 10.3.1 partially re-introduced `__init__` support for classes with user-implemented `__new__`, those relying on PyObjC's `__new__` still cannot use `__init__`.
fix
Carefully review classes that override `__new__` and use `__init__` in conjunction with PyObjC, especially for subclasses of Objective-C classes. You may need to adapt to PyObjC's object construction patterns, typically favoring `init` methods.
affects: 10.3 - 10.3.1
breakingPyObjC 10.0 removed bindings for the `IMServicePlugIn` framework, as it was deprecated in macOS 10.13 and removed in macOS 14.
fix
If your application relied on `IMServicePlugIn` bindings, you must either target an older macOS and PyObjC version or migrate to alternative APIs if available.
affects: 10.0+
Upgrade
Version history
12.2.2latest on PyPI · released Aug 11, 2026
Audit
Dependencies
pyobjc-corerequiredProvides the core bridge between Python and Objective-C, essential for all PyObjC framework bindings.
Agent activity
19 hits · last 30 days
node
16
Resources
pyobjc-framework-cfnetwork — pip install pyobjc-framework-cfnetwork · libregistry