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-NetworkExtensionVerified import paths — ran on the pinned version, not inferred.
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.
Upgrade to Python 3.10 or newer, or use an older PyObjC version compatible with your Python environment.
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.
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.
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.
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.
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.