PyObjC ThreadNetwork Framework

12.1 · active · verified Tue Apr 14

pyobjc-framework-threadnetwork provides Python wrappers for the macOS ThreadNetwork framework, enabling Python scripts to interact with Apple's Thread networking APIs. As part of the larger PyObjC project, it acts as a bridge between Python and Objective-C, allowing full-featured Cocoa applications to be written in pure Python. The library is actively maintained, with version 12.1 released on 2025-11-14, following a regular release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the basic import of the `ThreadNetwork` framework and a minimal interaction with a core Objective-C class (`NSObject` from `Foundation`) to confirm the PyObjC bridge is working. Direct, meaningful interaction with the `ThreadNetwork` framework typically requires specific macOS environments or hardware, which is beyond a general quickstart.

import ThreadNetwork
import Foundation

# The ThreadNetwork framework often requires specific macOS APIs and hardware
# to perform meaningful operations. This quickstart demonstrates importing
# the framework and a basic PyObjC interaction with NSObject from Foundation
# to illustrate the bridge's functionality.

# Instantiate a generic Objective-C NSObject using PyObjC's Pythonic syntax (since PyObjC 10.4)
# For older PyObjC versions or explicit Objective-C style:
# obj = Foundation.NSObject.alloc().init()
obj = Foundation.NSObject.new()

print(f"Successfully imported ThreadNetwork and created an NSObject: {obj.description()}")
print(f"Is obj an instance of NSObject? {isinstance(obj, Foundation.NSObject)}")

view raw JSON →