{"id":15009892,"url":"https://github.com/sethmlarson/selectors2","last_synced_at":"2025-10-03T19:30:21.151Z","repository":{"id":57465335,"uuid":"71904048","full_name":"sethmlarson/selectors2","owner":"sethmlarson","description":"Backported, durable, and portable selectors designed to replace the standard library selectors module.","archived":true,"fork":false,"pushed_at":"2020-07-21T22:39:10.000Z","size":77,"stargazers_count":14,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-30T11:54:47.551Z","etag":null,"topics":["async","devpoll","epoll","io","kqueue","poll","python","python2","python3","select","selector"],"latest_commit_sha":null,"homepage":"https://twitter.com/sethmlarson","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sethmlarson.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-25T14:16:42.000Z","updated_at":"2023-01-28T13:36:47.000Z","dependencies_parsed_at":"2022-09-13T03:11:00.581Z","dependency_job_id":null,"html_url":"https://github.com/sethmlarson/selectors2","commit_stats":null,"previous_names":["sethmichaellarson/selectors2"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/sethmlarson/selectors2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethmlarson%2Fselectors2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethmlarson%2Fselectors2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethmlarson%2Fselectors2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethmlarson%2Fselectors2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sethmlarson","download_url":"https://codeload.github.com/sethmlarson/selectors2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethmlarson%2Fselectors2/sbom","scorecard":{"id":813296,"data":{"date":"2025-08-11","repo":{"name":"github.com/sethmlarson/selectors2","commit":"c0e29dbcccd89e38842e270bf800aa4ef30c9c28"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Code-Review","score":2,"reason":"Found 2/7 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: pipCommand not pinned by hash: .travis/install.sh:40","Warn: pipCommand not pinned by hash: .travis/install.sh:41","Warn: pipCommand not pinned by hash: .travis/install.sh:43","Warn: pipCommand not pinned by hash: .travis/install.sh:46","Info:   0 out of   4 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2019-41 / GHSA-qfc5-mcwq-26q8"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T13:38:48.436Z","repository_id":57465335,"created_at":"2025-08-23T13:38:48.436Z","updated_at":"2025-08-23T13:38:48.436Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278217052,"owners_count":25950032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","devpoll","epoll","io","kqueue","poll","python","python2","python3","select","selector"],"created_at":"2024-09-24T19:29:02.666Z","updated_at":"2025-10-03T19:30:20.838Z","avatar_url":"https://github.com/sethmlarson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"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 \u003chttps://www.python.org/dev/peps/pep-0475/\u003e`_ (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 \u003chttps://github.com/shazow/urllib3\u003e`_ project\n(history in PR `#1001 \u003chttps://github.com/shazow/urllib3/pull/1001\u003e`_) 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 \u003chttps://saythanks.io/to/SethMichaelLarson\u003e`_,\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 \u0026 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 \u0026 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethmlarson%2Fselectors2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsethmlarson%2Fselectors2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethmlarson%2Fselectors2/lists"}