Registry / http-networking / pyobjc-framework-networkextension

pyobjc-framework-networkextension

JSON →
library12.2pypypiunverified

PyObjC Framework NetworkExtension provides Python wrappers for Apple's NetworkExtension framework on macOS. It enables Python applications to interact with system-level networking features, such as VPN configuration and management. Currently at version 12.1, this library is part of the larger PyObjC project, which generally aligns its release cadence with new macOS SDK versions.

pip install pyobjc-framework-NetworkExtension
INSTALL
IMPORT
SIG · PYOBJC-FRAMEWORK-N
P
pyobjc-framework-networkextension
http-networkingpythonv12.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.920 runs
build_error
glibc
py 3.103.920 runs
build_error
Code
Verified usage

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

NetworkExtension
import NetworkExtension
PyObjC maps Objective-C frameworks directly to Python modules with the same name.
NEVPNManager
from NetworkExtension import NEVPNManager

This quickstart demonstrates how to list existing VPN configurations using `NEVPNManager`. It retrieves the shared manager instance, asynchronously loads all VPN preferences, and prints the names and enabled status of any found configurations. Note that proper entitlements and code signing are usually required for real-world usage of NetworkExtension APIs.

import NetworkExtension import objc from Foundation import NSLog import threading # Note: Accessing NetworkExtension APIs typically requires specific # entitlements in your application's Info.plist and proper code signing. # This script may require root privileges or fail without them. def completion_handler(managers, error): if error: NSLog('Error loading VPN configurations: %@', error) elif managers: NSLog('Found %d VPN configurations:', len(managers)) for manager in managers: NSLog(' - Name: %@, Enabled: %@', manager.localizedDescription(), 'Yes' if manager.enabled() else 'No') else: NSLog('No VPN configurations found.') # Signal that the async operation is complete completion_event.set() NSLog('Attempting to load VPN configurations...') # Use a threading.Event to wait for the asynchronous callback in a script completion_event = threading.Event() manager_class = NetworkExtension.NEVPNManager manager = manager_class.sharedManager() # loadAllFromPreferencesWithCompletionHandler_ is an asynchronous call. # The Objective-C block is automatically translated to a Python callable. manager.loadAllFromPreferencesWithCompletionHandler_(completion_handler) # Wait for the completion handler to be called (max 5 seconds) completion_event.wait(5.0) NSLog('Quickstart finished.')
Debug
Known issues
breakingPyObjC 12.0 (and thus pyobjc-framework-networkextension 12.0) dropped support for Python 3.9. PyObjC 11.0 dropped support for Python 3.8. Ensure your Python version meets the `requires_python` specification (currently >=3.10).
fix
Upgrade to Python 3.10 or newer, or use an older PyObjC version compatible with your Python environment.
affects: >=11.0
breakingStarting with PyObjC 11.1, the core bridge's Automatic Reference Counting (ARC) behavior for Objective-C initializer methods (`init` family) was aligned with `clang`'s documentation. This means `init` methods now correctly 'steal' a reference to `self` and return a new one. This can affect custom Objective-C classes implemented in Python, particularly in how references are managed during initialization.
fix
Review custom Python-implemented Objective-C classes, especially `__new__` and `__init__` methods, to ensure correct reference handling under the updated ARC semantics. Consult PyObjC's documentation on initializer methods.
affects: >=11.1
gotchaPyObjC 10.3 initially removed support for calling `__init__` when a user-defined `__new__` was present in an Objective-C class implemented in Python. While 10.3.1 re-enabled this for user-implemented `__new__`, `__init__` still cannot be used when relying on PyObjC's *default* `__new__` implementation.
fix
If implementing Objective-C classes in Python and providing a custom `__new__`, ensure `__init__` is used as expected. If relying on PyObjC's default `__new__`, be aware that `__init__` might not be called in the traditional Python sense for initial object setup.
affects: 10.3.x
breakingFramework bindings can be removed following Apple's deprecation schedule. For example, `IMServicePlugIn` bindings were removed in PyObjC 10.0 because the framework was deprecated in macOS 10.13 and removed in macOS 14.
fix
Always consult Apple's Developer documentation for framework deprecations when updating macOS or PyObjC. Be prepared to update code if a framework or specific APIs are removed.
affects: >=10.0
gotchaAs of PyObjC 10.1, `os.fspath(someURL)` will raise a `TypeError` if the provided Cocoa `NSURL` or `CFURLRef` object does *not* refer to a local filesystem path. It correctly works for local filesystem paths, enabling their use with Python's filesystem APIs.
fix
When working with Cocoa URL objects, ensure `os.fspath()` is only called on URLs known to refer to local filesystem paths. For other URL types, use appropriate `NSURL` or `CFURLRef` methods for path extraction or conversion.
affects: >=10.1
gotchaExperimental free-threading support (PEP 703) introduced in Python 3.13 is *experimentally* supported by PyObjC 11.0. Older versions like 10.3 explicitly stated they did not support it. While `pyobjc-core` 12.1 is listed as compatible with 'Python :: Free Threading :: 3 - Stable' on PyPI, users should exercise caution with experimental features.
fix
If using Python 3.13 with experimental free-threading, thoroughly test your PyObjC applications. Consider running without free-threading enabled if stability issues arise, or stick to older Python versions if strict stability is paramount.
affects: >=10.3
Upgrade
Version history
12.2latest on PyPI · released May 30, 2026
Audit
Dependencies
pyobjc-corerequiredProvides the core Python-Objective-C bridge functionality required by all PyObjC framework bindings.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
2
Resources
pyobjc-framework-networkextension — pip install pyobjc-framework-networkextension · libregistry