Registry / http-networking / pyasyncore

pyasyncore

JSON →
library1.0.5pypypi✓ verified 27d ago

pyasyncore is a compatibility library that re-introduces the `asyncore` module, which was removed from the Python standard library in version 3.12. It allows existing codebases that rely on `asyncore` to continue functioning on Python 3.12 and later. The current version is 1.0.5, with releases typically tied to Python version compatibility or critical bug fixes.

pip install pyasyncore
INSTALL
IMPORT
SIG · PYASYNCORE
P
pyasyncore
http-networkingpythonv1.0.5
Install
1.5s avg
Import
15ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.0.5 · pip install
no network on importno background threads
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.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.016s · 17.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.014s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

asyncore
✓ import asyncore
The library provides the top-level 'asyncore' module, mimicking the standard library behavior prior to Python 3.12.
asynchat
✓ import asynchat
While 'pyasyncore' primarily backports 'asyncore', the related 'pyasynchat' library (from the same author) backports 'asynchat'.

This quickstart demonstrates a basic `asyncore` echo server. It creates a server that listens on `127.0.0.1:8080` and echoes back any data received from connected clients. Run this script, then connect with `nc 127.0.0.1 8080` in another terminal to test. This example is identical to how `asyncore` would have been used in Python versions prior to 3.12.

import asyncore import socket class EchoHandler(asyncore.dispatcher_with_send): def handle_read(self): data = self.recv(8192) if data: self.send(data) class EchoServer(asyncore.dispatcher): def __init__(self, host, port): asyncore.dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind((host, port)) self.listen(5) print(f"Echo server listening on {host}:{port}") def handle_accept(self): pair = self.accept() if pair is not None: sock, addr = pair print(f"Incoming connection from {repr(addr)}") handler = EchoHandler(sock) if __name__ == "__main__": # Note: asyncore is blocking. For a simple example, it runs forever. # In a real application, you might run it in a separate thread # or integrate it with other event loops (though this defeats its purpose). try: server = EchoServer('127.0.0.1', 8080) asyncore.loop() except KeyboardInterrupt: print("\nServer stopped.")
Debug
Known issues
breakingThe `asyncore` module was removed from the Python standard library starting with Python 3.12. Code relying on `import asyncore` will raise an `ImportError` on Python 3.12 and later.
fix
Install `pyasyncore` to restore the `asyncore` module for compatibility: `pip install pyasyncore`.
affects: Python 3.12+
gotcha`asyncore` is a legacy module. While `pyasyncore` provides compatibility for older code, for new asynchronous application development, Python's `asyncio` module is the modern and recommended approach.
fix
For new projects or significant refactoring, consider migrating to `asyncio` to leverage modern async/await syntax and better ecosystem support.
affects: All versions using `pyasyncore`
gotcha`pyasyncore` is specifically intended to provide `asyncore` for Python 3.12 and newer. Installing it on older Python versions (where `asyncore` is still part of the standard library) may lead to shadowing the built-in module, potentially causing subtle behavioral differences or confusion.
fix
Only install and use `pyasyncore` on Python 3.12 or newer, where the standard library `asyncore` is absent.
affects: Python versions < 3.12
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'asyncore'
The `asyncore` module was removed from the Python standard library in Python 3.12 and later, so direct import attempts will fail if `pyasyncore` is not installed.
fix
Install the `pyasyncore` compatibility library using `pip install pyasyncore`.
import pyasyncore
Developers might mistakenly try to import `pyasyncore` directly, but the compatibility library re-introduces the original `asyncore` module under its original name.
fix
The correct import statement is `import asyncore` after `pyasyncore` has been installed.
error: package directory 'asyncore' does not exist
This error occurred in early versions of `pyasyncore` (specifically 1.0.0) during installation from source distributions, due to a misconfiguration in the package's build process.
fix
Ensure you are using the latest version of `pyasyncore` (1.0.1 or newer) and `pip`, as this bug was addressed in subsequent releases. Upgrade using `pip install --upgrade pyasyncore`.
Upgrade
Version history
1.0.5latest on PyPI · released Jan 5, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
14
Resources
pyasyncore — pip install pyasyncore · libregistry