{ "info": { "author": "Stefan H. Holek", "author_email": "stefan@epy.co.at", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Python Software Foundation License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "=====\nterm\n=====\n--------------------------------------\nAn enhanced version of the tty module\n--------------------------------------\n\nOverview\n========\n\nThe **term** package is an enhanced version of the standard library's\ntty_ module.\nIt provides context managers for temporarily switching the terminal\nto *raw* or *cbreak* mode and allows to retrieve the cursor position\nwithout having to resort to curses.\n\n.. _tty: https://docs.python.org/3/library/tty.html\n\nPackage Contents\n================\n\nsetraw(fd, when=TCSAFLUSH, min=1, time=0)\n Put the terminal in raw mode.\n\nsetcbreak(fd, when=TCSAFLUSH, min=1, time=0)\n Put the terminal in cbreak mode.\n\nrawmode(fd, when=TCSAFLUSH, min=1, time=0)\n Context manager to put the terminal in raw mode.\n\ncbreakmode(fd, when=TCSAFLUSH, min=1, time=0)\n Context manager to put the terminal in cbreak mode.\n\nopentty(bufsize=1)\n Context manager returning an rw stream connected to /dev/tty.\n The stream is None if the device could not be opened.\n\ngetyx()\n Return the cursor position as 1-based (line, col) tuple.\n Line and col are 0 if the device cannot be opened or the terminal\n does not support DSR 6.\n\nExamples\n========\n\nTo resize the terminal window we enter cbreak mode and write the new\ndimensions to the tty::\n\n from term import opentty, cbreakmode\n\n with opentty() as tty:\n if tty is not None:\n with cbreakmode(tty, min=0):\n tty.write(b'\\033[8;25;80t');\n\n print('terminal resized')\n\nYou may also want to look at the `source code`_ of getyx().\n\n.. _`source code`: https://github.com/stefanholek/term/blob/master/term/__init__.py#L143\n\nCaveat\n======\n\nThe terminal must be in canonical mode before any of the functions and\ncontext managers can be used. They are not meant for switching between\nraw and cbreak modes. Nesting context managers of the same type is allowed\nthough.\n\nDocumentation\n=============\n\nPlease also see the `API Documentation`_.\n\n.. _`API Documentation`: https://term.readthedocs.io/en/stable/\n\n\nChangelog\n=========\n\n2.3 - 2019-02-08\n----------------\n\n- Add MANIFEST.in.\n [stefan]\n\n- Release as wheel.\n [stefan]\n\n- Drop explicit GPL because the PSF license is GPL-compatible anyway.\n [stefan]\n\n2.2 - 2017-02-05\n----------------\n\n- Support Python 2.6-3.6 without 2to3.\n [stefan]\n\n2.1 - 2014-04-19\n----------------\n\n- Remove setuptools from install_requires because it isn't.\n [stefan]\n\n2.0 - 2012-04-27\n----------------\n\n- Open /dev/tty in binary mode under Python 3.\n [stefan]\n\n- Disable buffering if the device is not seekable.\n [stefan]\n\n- Remove getmaxyx since it cannot be implemented reliably.\n [stefan]\n\n- Support Python 2.5.\n [stefan]\n\n- Change license to GPL or PSF to avoid relicensing of PSF code.\n [stefan]\n\n1.0 - 2012-04-11\n----------------\n\n- Initial release.\n [stefan]\n", "description_content_type": "", "docs_url": "https://pythonhosted.org/term/", "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stefanholek/term", "keywords": "terminal tty raw cbreak opentty getyx cursor position", "license": "PSFL", "maintainer": "", "maintainer_email": "", "name": "term", "package_url": "https://pypi.org/project/term/", "platform": "", "project_url": "https://pypi.org/project/term/", "project_urls": { "Homepage": "https://github.com/stefanholek/term" }, "release_url": "https://pypi.org/project/term/2.3/", "requires_dist": null, "requires_python": "", "summary": "An enhanced version of the tty module", "version": "2.3" }, "last_serial": 4796430, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "4e2b48daeed5facf61b84c26f783a57b", "sha256": "b85a4e12794532befc4a3b960528ee640d4ba2609f4bc5cfaec4d8f71f8f7b28" }, "downloads": -1, "filename": "term-1.0.zip", "has_sig": false, "md5_digest": "4e2b48daeed5facf61b84c26f783a57b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7404, "upload_time": "2012-04-11T12:35:32", "url": "https://files.pythonhosted.org/packages/af/54/1ef33175123947da2edddcdbb987f5d6784bd6fafe10e5683d7e67e28b60/term-1.0.zip" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "fc8fab733cd1d08e5110b7195d2d4930", "sha256": "16892fd4cace3c805ade99443ac706ad8b239fadf424da925eeceea0c86771b1" }, "downloads": -1, "filename": "term-2.0.zip", "has_sig": false, "md5_digest": "fc8fab733cd1d08e5110b7195d2d4930", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8572, "upload_time": "2012-04-27T16:17:24", "url": "https://files.pythonhosted.org/packages/e9/96/13a15108d8f38ee7c948bb0c85729fc62b7394ffbda34624d1d239ecfea5/term-2.0.zip" } ], "2.1": [ { "comment_text": "", "digests": { "md5": "4bde89aa6a91527de12b473f34e8ee7b", "sha256": "6b20da4fa4f2e5509a3cd9e0ffbc1e05553dfbdc7962d0b212d74bdea5c87a6d" }, "downloads": -1, "filename": "term-2.1.zip", "has_sig": false, "md5_digest": "4bde89aa6a91527de12b473f34e8ee7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14725, "upload_time": "2014-04-19T19:55:00", "url": "https://files.pythonhosted.org/packages/00/6e/174646519d935b44a60ca1e6cabed0e921c8dcbccdbcc0652829936afdb8/term-2.1.zip" } ], "2.2": [ { "comment_text": "", "digests": { "md5": "0d13424e23740fc41b87f7697d403f72", "sha256": "d513ed19b427746aa3631d33f2f4f7ee75c0babeb973277e2e0b0f2eda0ba79e" }, "downloads": -1, "filename": "term-2.2.zip", "has_sig": false, "md5_digest": "0d13424e23740fc41b87f7697d403f72", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15527, "upload_time": "2017-02-05T13:41:17", "url": "https://files.pythonhosted.org/packages/61/be/8d9814b84069178ed026f35d5a85f6ccfb9746f3301c221db106452567ff/term-2.2.zip" } ], "2.3": [ { "comment_text": "", "digests": { "md5": "17acbb6c56eff20c2389026f47d5dc7a", "sha256": "9bbd78a49e3981adad6430d6aea2fa24ad39a7278c281315726cd9635bee030c" }, "downloads": -1, "filename": "term-2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "17acbb6c56eff20c2389026f47d5dc7a", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 6635, "upload_time": "2019-02-08T17:01:47", "url": "https://files.pythonhosted.org/packages/81/fd/1d40517372abb2cea4b4f63bad7d884d49982e20aa50a0f1f452cbb9db09/term-2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ab0c1bce381b1109fe4390c56aa06237", "sha256": "3dcc8c212e04700784e5c1c5b601916ba0549ae6025b35b64fd62144899e7180" }, "downloads": -1, "filename": "term-2.3.zip", "has_sig": false, "md5_digest": "ab0c1bce381b1109fe4390c56aa06237", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11389, "upload_time": "2019-02-08T17:01:32", "url": "https://files.pythonhosted.org/packages/3a/fe/ae8aa27631296cd55a411df0cefa8a7fd34643af2018d8dc55921a86bead/term-2.3.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "17acbb6c56eff20c2389026f47d5dc7a", "sha256": "9bbd78a49e3981adad6430d6aea2fa24ad39a7278c281315726cd9635bee030c" }, "downloads": -1, "filename": "term-2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "17acbb6c56eff20c2389026f47d5dc7a", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 6635, "upload_time": "2019-02-08T17:01:47", "url": "https://files.pythonhosted.org/packages/81/fd/1d40517372abb2cea4b4f63bad7d884d49982e20aa50a0f1f452cbb9db09/term-2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ab0c1bce381b1109fe4390c56aa06237", "sha256": "3dcc8c212e04700784e5c1c5b601916ba0549ae6025b35b64fd62144899e7180" }, "downloads": -1, "filename": "term-2.3.zip", "has_sig": false, "md5_digest": "ab0c1bce381b1109fe4390c56aa06237", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11389, "upload_time": "2019-02-08T17:01:32", "url": "https://files.pythonhosted.org/packages/3a/fe/ae8aa27631296cd55a411df0cefa8a7fd34643af2018d8dc55921a86bead/term-2.3.zip" } ] }