aioreadline


Nameaioreadline JSON
Version 2024.1.25 PyPI version JSON
download
home_page
Summaryasync-compatible libreadline wrapper
upload_time2024-01-28 08:30:44
maintainer
docs_urlNone
author
requires_python>=3.0
licensePermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords readline ctypes
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            aioreadline
===========

Python has a builtin readline module. However, the builtin module is difficult
to use in async Python code. This module provides an interface around the
async-compatible functions of libreadline using a ctypes wrapper.

Example
-------

```
import asyncio, atexit

async def _main():
	while True:
		line = await aiorl.getLine()
		
		if line is None or line == b"quit":
			aiorl.stop()
			loop.stop()
			break
		elif len(line) > 0:
			aiorl.add_history(line)
			print(line)

loop = asyncio.get_event_loop()
loop.create_task(_main())

aiorl = AIOReadline(prompt="> ", loop=loop, history_file=".aioreadline_history")

atexit.register(lambda: aiorl.stop())

try:
	loop.run_forever()
except KeyboardInterrupt:
	loop.stop()
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "aioreadline",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.0",
    "maintainer_email": "",
    "keywords": "readline,ctypes",
    "author": "",
    "author_email": "Mario Kicherer <dev@kicherer.org>",
    "download_url": "https://files.pythonhosted.org/packages/e0/75/14fdf4824de264202a0016755d6ef36b84a3f2e1ee0eec3713a8aae82083/aioreadline-2024.1.25.tar.gz",
    "platform": null,
    "description": "aioreadline\n===========\n\nPython has a builtin readline module. However, the builtin module is difficult\nto use in async Python code. This module provides an interface around the\nasync-compatible functions of libreadline using a ctypes wrapper.\n\nExample\n-------\n\n```\nimport asyncio, atexit\n\nasync def _main():\n\twhile True:\n\t\tline = await aiorl.getLine()\n\t\t\n\t\tif line is None or line == b\"quit\":\n\t\t\taiorl.stop()\n\t\t\tloop.stop()\n\t\t\tbreak\n\t\telif len(line) > 0:\n\t\t\taiorl.add_history(line)\n\t\t\tprint(line)\n\nloop = asyncio.get_event_loop()\nloop.create_task(_main())\n\naiorl = AIOReadline(prompt=\"> \", loop=loop, history_file=\".aioreadline_history\")\n\natexit.register(lambda: aiorl.stop())\n\ntry:\n\tloop.run_forever()\nexcept KeyboardInterrupt:\n\tloop.stop()\n```\n",
    "bugtrack_url": null,
    "license": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "async-compatible libreadline wrapper",
    "version": "2024.1.25",
    "project_urls": {
        "Homepage": "https://github.com/anyc/aioreadline/",
        "Issues": "https://github.com/anyc/aioreadline/issues"
    },
    "split_keywords": [
        "readline",
        "ctypes"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ed11e7f4231f6ce586933e3655dca32dc92ba526d0ff976a0db8546726b6fd7",
                "md5": "0adbee608f41bff31ee0931fe2537b5c",
                "sha256": "493d1a969978d41f578d9dea2204629a12c3634675db002e0776c675214e5b74"
            },
            "downloads": -1,
            "filename": "aioreadline-2024.1.25-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0adbee608f41bff31ee0931fe2537b5c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0",
            "size": 5087,
            "upload_time": "2024-01-28T08:30:42",
            "upload_time_iso_8601": "2024-01-28T08:30:42.523138Z",
            "url": "https://files.pythonhosted.org/packages/8e/d1/1e7f4231f6ce586933e3655dca32dc92ba526d0ff976a0db8546726b6fd7/aioreadline-2024.1.25-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e07514fdf4824de264202a0016755d6ef36b84a3f2e1ee0eec3713a8aae82083",
                "md5": "fddb6488d37fd85310d4f60db89b316c",
                "sha256": "1fd1b6c9c682f855a1ef6ab2c2457822ff233161029c5e7ef54478ca895a6b37"
            },
            "downloads": -1,
            "filename": "aioreadline-2024.1.25.tar.gz",
            "has_sig": false,
            "md5_digest": "fddb6488d37fd85310d4f60db89b316c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0",
            "size": 3866,
            "upload_time": "2024-01-28T08:30:44",
            "upload_time_iso_8601": "2024-01-28T08:30:44.364355Z",
            "url": "https://files.pythonhosted.org/packages/e0/75/14fdf4824de264202a0016755d6ef36b84a3f2e1ee0eec3713a8aae82083/aioreadline-2024.1.25.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-28 08:30:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "anyc",
    "github_project": "aioreadline",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "aioreadline"
}
        
Elapsed time: 3.92183s