selectors2
Back-ported, durable, and portable selectors
What it is and what it does
Selectors2 is a backport of Python's selectors module designed for older Python versions (2.6–3.4) and Jython. It provides a unified API for monitoring file descriptors (sockets and pipes) for I/O readiness across different operating systems by selecting the best available selector type—epoll on Linux, kqueue on BSD/macOS, poll on some Unix systems, or the portable select() fallback. The package implements PEP 475 to handle interrupted system calls gracefully, retrying rather than returning spurious empty events.
The module is a drop-in replacement for the standard library selectors module and was originally developed to solve real-world durability and portability problems. It supports monkey-patching scenarios and detects systems that claim to support a selector but don't actually implement it. However, the package has been abandoned since July 21, 2020 and receives no maintenance; modern Python users should use the standard library selectors module instead.
Use it for:
- Porting async I/O code to Python 2.6–3.4 environments where the standard selectors module is unavailable or incomplete.
- Building network libraries that need robust selector support across Linux, macOS, Windows, and Jython without external async frameworks.
- Handling interrupted system calls reliably in older Python versions that predate PEP 475.
- Monitoring multiple sockets or pipes for read/write events in legacy applications that cannot upgrade Python versions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a backported, cross-platform replacement for Python's standard library selectors module, supporting multiple selector types (epoll, kqueue, poll, select) across Linux, macOS, Windows, and Jython.
No, unless you are maintaining legacy Python 2.6–3.4 code that requires selector functionality and cannot use the standard library module. The package is abandoned (last release July 21, 2020, repository archived) and receives no security or maintenance updates. Modern Python users should use the standard library selectors module instead.
Install
selectors2 on PyPI
pip
pip install selectors2uv
uv add selectors2poetry
poetry add selectors2Installing selectors2
Before you install
Low install friction with no runtime dependencies. However, the package is abandoned as of July 21, 2020 and its repository is archived. Use only if you need Python 2.6–3.4 support or cannot upgrade to the standard library selectors module.
License in practice
Dual-licensed under MIT and PSF License, both permissive. You may use, modify, and distribute this package freely in commercial or private projects with minimal restrictions.
Quickstart
import selectors2 as selectors
s = selectors.DefaultSelector()
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.register(sock, selectors.EVENT_WRITE)
events = s.select(timeout=1.0)
for key, event in events:
if event & selectors.EVENT_WRITE:
key.fileobj.send(b'data')
Requires a platform with a selector available (select.select, epoll, kqueue, poll, or devpoll); raises RuntimeError on platforms without any selector.
Verify before relying
- Whether PEP 475 interrupt-retry behavior remains necessary in modern Python versions.
- Current real-world adoption outside of legacy Python 2 codebases.
- Compatibility with Python versions beyond 3.4 despite abandonment.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,215 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 159,258/month — #10,702 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: selectors2-2.0.2-py2.py3-none-any.whl
Keywords: async, file, socket, select, backport
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
relrel is a cross-platform asynchronous event…
permissive · top 15,000 on PyPI
cssselect2cssselect2 parses and matches CSS4 selectors…
permissive · top 1,000 on PyPI
selectolaxselectolax is a fast HTML5 parser with CSS…
permissive · top 5,000 on PyPI
cssselectcssselect parses CSS3 selectors and translates…
permissive · top 1,000 on PyPI
whichcraftProvides a cross-platform, cross-Python…
permissive · top 15,000 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
subprocess32A backport of Python 3's subprocess module to…
permissive · top 15,000 on PyPI
eval-type-backportEnables newer Python typing syntax (like `X |…
permissive · top 1,000 on PyPI
asynctestExtends Python's unittest module with test…
permissive · top 5,000 on PyPI
typing-extensionsProvides backported and experimental type hints…
permissive · top 100 on PyPI