{ "info": { "author": "Seth Michael Larson", "author_email": "sethmichaellarson@protonmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "License :: OSI Approved :: Python Software Foundation License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "Selectors2\n==========\n\n.. image:: https://img.shields.io/travis/SethMichaelLarson/selectors2/master.svg?style=flat-square\n :target: https://travis-ci.org/SethMichaelLarson/selectors2\n.. image:: https://img.shields.io/appveyor/ci/SethMichaelLarson/selectors2/master.svg?style=flat-square\n :target: https://ci.appveyor.com/project/SethMichaelLarson/selectors2\n.. image:: https://img.shields.io/pypi/v/selectors2.svg?style=flat-square\n :target: https://pypi.python.org/pypi/selectors2\n.. image:: https://img.shields.io/badge/say-thanks-ff69b4.svg?style=flat-square\n :target: https://saythanks.io/to/SethMichaelLarson\n\nBackported, durable, and portable selectors designed to replace\nthe standard library selectors module.\n\nFeatures\n--------\n\n* Support for all major platforms. (Linux, Mac OS, Windows)\n* Support for Python 2.6 or later and **Jython**.\n* Support many different selectors\n * ``select.kqueue`` (BSD, Mac OS)\n * ``select.devpoll`` (Solaris)\n * ``select.epoll`` (Linux 2.5.44+)\n * ``select.poll`` (Linux, Mac OS)\n * ``select.select`` - (Linux, Mac OS, Windows)\n* Support for `PEP 475 `_ (Retries system calls on interrupt)\n* Support for modules which monkey-patch the standard library after import (like greenlet, gevent)\n* Support for systems which define a selector being available but don't actually implement it. ()\n\nAbout\n-----\n\nThis module was originally written by me for the `urllib3 `_ project\n(history in PR `#1001 `_) but it was decided that it would\nbe beneficial for everyone to have access to this work.\n\nAll the additional features that ``selectors2`` provides are real-world problems that have occurred\nand been reported during the lifetime of its maintenance and use within ``urllib3``.\n\nIf this work is useful to you, `feel free to say thanks `_,\ntakes only a little time and really brightens my day! :cake:\n\nCan this module be used in place of ``selectors``?\n--------------------------------------------------\n\nYes! This module is a 1-to-1 drop-in replacement for ``selectors`` and\nprovides all selector types that would be available in ``selectors`` including\n``DevpollSelector``, ``KqueueSelector``, ``EpollSelector``, ``PollSelector``, and ``SelectSelector``.\n\nWhat is different between `selectors2` and `selectors34`?\n---------------------------------------------------------\n\nThis module is similar to ``selectors34`` in that it supports Python 2.6 - 3.3\nbut differs in that this module also implements PEP 475 for the backported selectors.\nThis allows similar behaviour between Python 3.5+ selectors and selectors from before PEP 475.\nIn ``selectors34``, an interrupted system call would result in an incorrect return of no events, which\nfor some use cases is not an acceptable behavior.\n\nI will also add here that ``selectors2`` also makes large improvements on the test suite surrounding it\nproviding 100% test coverage for each selector. The test suite is also more robust and tests durability\nof the selectors in many different situations that aren't tested in ``selectors34``.\n\nWhat types of objects are supported?\n------------------------------------\n\nAt this current time ``selectors2`` only support the ``SelectSelector`` for Windows which cannot select on non-socket objects.\nOn Linux and Mac OS, both sockets and pipes are supported (some other types may be supported as well, such as fifos or special file devices).\n\nWhat if I have to support a platform without ``select.select``?\n---------------------------------------------------------------\n\nThere are a few platforms that don't have a selector available, notably\nGoogle AppEngine. When running on those platforms any call to ``DefaultSelector()``\nwill raise a ``RuntimeError`` explaining that there are no selectors available.\n\nLicense\n-------\n\nThis module is dual-licensed under MIT and PSF License.\n\nInstallation\n------------\n\n``$ python -m pip install selectors2``\n\nUsage\n-----\n.. code-block:: python\n\n import sys\n import selectors2 as selectors\n\n # Use DefaultSelector, it picks the best\n # selector available for your platform! :)\n s = selectors.DefaultSelector()\n\n import socket\n\n # We're going to use Google as an example.\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n sock.connect((\"www.google.com\", 80))\n\n # Register the file to be watched for write availibility.\n s.register(sock, selectors.EVENT_WRITE)\n\n # Give a timeout in seconds or no\n # timeout to block until an event happens.\n events = s.select(timeout=1.0)\n\n # Loop over all events that happened.\n for key, event in events:\n if event & selectors.EVENT_WRITE:\n key.fileobj.send(b'HEAD / HTTP/1.1\\r\\n\\r\\n')\n\n # Change what event you're waiting for.\n s.modify(sock, selectors.EVENT_READ)\n\n # Timeout of None let's the selector wait as long as it needs to.\n events = s.select(timeout=None)\n for key, event in events:\n if event & selectors.EVENT_READ:\n data = key.fileobj.recv(4096)\n print(data)\n\n # Stop watching the socket.\n s.unregister(sock)\n sock.close()\n\n\nChangelog\n=========\n\nRelease 2.0.1 (August 17, 2017)\n-------------------------------\n\n* [BUGFIX] Timeouts would not be properly recalculated after receiving an EINTR error.\n\nRelease 2.0.0 (May 30, 2017)\n----------------------------\n\n* [FEATURE] Add support for Jython with ``JythonSelectSelector``.\n* [FEATURE] Add support for ``/dev/devpoll`` with ``DevpollSelector``.\n* [CHANGE] Raises a ``RuntimeError`` instead of ``ValueError`` if there is no selector available.\n* [CHANGE] No longer wraps exceptions in ``SelectorError``, raises original exception including\n in timeout situations.\n* [BUGFIX] Detect defects in a system that defines a selector but does not implement it.\n* [BUGFIX] Can now detect a change in the ``select`` module after import such as when\n ``gevent.monkey.monkey_patch()`` is called before importing ``selectors2``.\n\nRelease 1.1.1 (February 6, 2017)\n--------------------------------\n\n* [BUGFIX] Platforms that define ``select.kqueue`` would not have ``KqueueSelector`` as the ``DefaultSelector``.\n\nRelease 1.1.0 (January 17, 2017)\n--------------------------------\n\n* [FEATURE] Make system calls faster for Python versions that support PEP 475.\n* [FEATURE] Wheels are now universal.\n\nRelease 1.0.0 (November 3, 2016)\n--------------------------------\n\n* Initial implementation of ``selectors2``.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.github.com/SethMichaelLarson/selectors2", "keywords": "async", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "selectors2", "package_url": "https://pypi.org/project/selectors2/", "platform": "", "project_url": "https://pypi.org/project/selectors2/", "project_urls": { "Homepage": "https://www.github.com/SethMichaelLarson/selectors2" }, "release_url": "https://pypi.org/project/selectors2/2.0.1/", "requires_dist": null, "requires_python": "", "summary": "Back-ported, durable, and portable selectors", "version": "2.0.1" }, "last_serial": 3104613, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "e2298971c11a5361fc183afee4595d07", "sha256": "03377544b1dbeb78ddc71d1e92b3a8b668f0564c534d0783fdb23720ffcfc960" }, "downloads": -1, "filename": "selectors2-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e2298971c11a5361fc183afee4595d07", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 10917, "upload_time": "2016-11-03T03:31:35", "url": "https://files.pythonhosted.org/packages/db/cf/1c4fa10aef24268c158ed4909139247737e4dc002e28b93c8f88ac93053f/selectors2-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "126079c54e8e23500b5da305ed8913f2", "sha256": "f28aaa0686c45487f8cbf4824bd477269f13c58cd2d1eb36e2d2e710b81383ba" }, "downloads": -1, "filename": "selectors2-1.0.tar.gz", "has_sig": false, "md5_digest": "126079c54e8e23500b5da305ed8913f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8182, "upload_time": "2016-11-03T03:31:32", "url": "https://files.pythonhosted.org/packages/8a/27/8e35d63d4a541814e40c137e08490b92dc589d4504474dade41361a8f1fb/selectors2-1.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "a16f2f66dec99134ba7f67a292f8398d", "sha256": "842397e61b0fcac391d2ca7d3b1212888bd0c8d105dff3bd0c02a46a14c6ae9b" }, "downloads": -1, "filename": "selectors2-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a16f2f66dec99134ba7f67a292f8398d", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 11769, "upload_time": "2017-01-18T02:23:29", "url": "https://files.pythonhosted.org/packages/cd/3b/e5352cf72a6f53c1290b4b400f15cfad273f6c66561c6c3911130860c2ff/selectors2-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "177f9e652267f673cb39c6898cd04ec8", "sha256": "ac839ddff978059fd625251b5b82680a8ad8301955f957491f451655c711e4c3" }, "downloads": -1, "filename": "selectors2-1.1.0.tar.gz", "has_sig": false, "md5_digest": "177f9e652267f673cb39c6898cd04ec8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22175, "upload_time": "2017-01-18T02:23:27", "url": "https://files.pythonhosted.org/packages/2d/61/b19729af7ebd776d76be7b464f4a9660b46f246ec2cda117e2e6a6a2c3e5/selectors2-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "f6aa0a2b82270b98ff562efa36e2cb03", "sha256": "3199fcf9ef90fb0af3a5536e6fa3a5e6d893a8ac581041fe33cd737031155d9c" }, "downloads": -1, "filename": "selectors2-1.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f6aa0a2b82270b98ff562efa36e2cb03", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 11851, "upload_time": "2017-02-07T04:16:28", "url": "https://files.pythonhosted.org/packages/1d/fe/93454101c63718780129fddb9ed22372c38d99326ccc43c67686b9c15663/selectors2-1.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b4867bdf9330b92cb6bf033e8d330d24", "sha256": "ef1eb63968155bc3bfb5bedf291374d058c3b0839b3b16604c6bdfd370e0c474" }, "downloads": -1, "filename": "selectors2-1.1.1.tar.gz", "has_sig": false, "md5_digest": "b4867bdf9330b92cb6bf033e8d330d24", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22219, "upload_time": "2017-02-07T04:16:27", "url": "https://files.pythonhosted.org/packages/ce/f8/4c67a53fc92434cb0fa03be3ae77dc7ae4b09b24ac4cedca8ba099f0841b/selectors2-1.1.1.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "fe312b7eac078aafa48c8d35b70f071f", "sha256": "893d82ca29d4328ca629f7fd6188e41248033e0054ea7b66beec0348cac51da4" }, "downloads": -1, "filename": "selectors2-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fe312b7eac078aafa48c8d35b70f071f", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 13618, "upload_time": "2017-05-30T18:41:13", "url": "https://files.pythonhosted.org/packages/ac/66/5b5c2038f7c90c6914500c966acfb2645472a90375372cc6cd2c5de7083a/selectors2-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eed97edecb9e3756749ac83aa0f95713", "sha256": "d27feb6b093c6488e95f51e11680ef17535e5e97381bd42cc329a7d2b470f0ec" }, "downloads": -1, "filename": "selectors2-2.0.0.tar.gz", "has_sig": false, "md5_digest": "eed97edecb9e3756749ac83aa0f95713", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19133, "upload_time": "2017-05-30T18:41:12", "url": "https://files.pythonhosted.org/packages/1c/e7/25b255fa50eeb5f33840814308f95d80902ac39a4522acf1e2c5e95c2c72/selectors2-2.0.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "b7738b117b4ac2b52fc915ae551d982a", "sha256": "ed3b473edddb85d4ca89e2beca9f01fffd411b3105e8f3c8d57d9edc11106bda" }, "downloads": -1, "filename": "selectors2-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b7738b117b4ac2b52fc915ae551d982a", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 13743, "upload_time": "2017-08-17T20:33:38", "url": "https://files.pythonhosted.org/packages/c9/89/8a07d6d6c78422c5151f68453e9741af4cd82bebcfa73923f73b3bdbef0d/selectors2-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5ffdc07456ff8bf3afff8dc2a96db6c0", "sha256": "81b77c4c6f607248b1d6bbdb5935403fef294b224b842a830bbfabb400c81884" }, "downloads": -1, "filename": "selectors2-2.0.1.tar.gz", "has_sig": false, "md5_digest": "5ffdc07456ff8bf3afff8dc2a96db6c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18600, "upload_time": "2017-08-17T20:33:36", "url": "https://files.pythonhosted.org/packages/a4/54/d690d931777ca7310562997fab09019582e6e557984c02d7647f3654f7f5/selectors2-2.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b7738b117b4ac2b52fc915ae551d982a", "sha256": "ed3b473edddb85d4ca89e2beca9f01fffd411b3105e8f3c8d57d9edc11106bda" }, "downloads": -1, "filename": "selectors2-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b7738b117b4ac2b52fc915ae551d982a", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 13743, "upload_time": "2017-08-17T20:33:38", "url": "https://files.pythonhosted.org/packages/c9/89/8a07d6d6c78422c5151f68453e9741af4cd82bebcfa73923f73b3bdbef0d/selectors2-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5ffdc07456ff8bf3afff8dc2a96db6c0", "sha256": "81b77c4c6f607248b1d6bbdb5935403fef294b224b842a830bbfabb400c81884" }, "downloads": -1, "filename": "selectors2-2.0.1.tar.gz", "has_sig": false, "md5_digest": "5ffdc07456ff8bf3afff8dc2a96db6c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18600, "upload_time": "2017-08-17T20:33:36", "url": "https://files.pythonhosted.org/packages/a4/54/d690d931777ca7310562997fab09019582e6e557984c02d7647f3654f7f5/selectors2-2.0.1.tar.gz" } ] }