AF_UNIX compatibility for Windows Python
afunix-windows provides two importable compatibility modules:
-
af_unix_asyncio_compatimplements theasyncioUnix-domain socket APIs. -
af_unix_socket_compatimplements synchronous, socket-style Unix-domain APIs.
On Unix-like platforms the modules delegate to Python's standard library. On
Windows they use native Winsock AF_UNIX support, including a ctypes fallback
for runtimes which do not expose all of the required functionality.
Installation
python -m pip install git+https://github.com/vast-cow/afunix-windows-py.git
Python 3.10 or newer is required.
Asyncio usage
from af_unix_asyncio_compat import open_unix_connection, start_unix_server
reader, writer = await open_unix_connection("./example.sock")
server = await start_unix_server(client_connected_callback, "./example.sock")
Synchronous usage
import af_unix_socket_compat as unix_socket
client = unix_socket.create_connection("./example.sock")
server = unix_socket.create_server("./example.sock", cleanup_socket=True)
Both modules expose an explicit install() migration helper. Prefer direct
imports in new applications because install() globally monkey-patches the
corresponding standard-library module.
See spec.md for API details, complete examples…
Top comments (1)
What is this licensed under and is there a repo somewhere hosting this?