term


Nameterm JSON
Version 2.5 PyPI version JSON
download
home_pagehttps://github.com/stefanholek/term
SummaryAn enhanced version of the tty module
upload_time2023-09-14 13:36:49
maintainer
docs_urlhttps://pythonhosted.org/term/
authorStefan H. Holek
requires_python!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7
licensePSF-2.0
keywords terminal tty setraw setcbreak opentty readto getyx cursor position escape sequence lightmode darkmode
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =====
term
=====
--------------------------------------
An enhanced version of the tty module
--------------------------------------

Overview
========

The **term** package is an enhanced version of the standard library's
tty_ module. It provides context managers for opening a terminal stream, and
for temporarily switching the terminal to raw or cbreak mode.

.. _tty: https://docs.python.org/3/library/tty.html

Package Contents
================

Terminal Control
----------------

setraw(fd, when=TCSAFLUSH, min=1, time=0)
    Put the terminal in raw mode.

setcbreak(fd, when=TCSAFLUSH, min=1, time=0)
    Put the terminal in cbreak mode.

rawmode(fd, when=TCSAFLUSH, min=1, time=0)
    Context manager to put the terminal in raw mode.

cbreakmode(fd, when=TCSAFLUSH, min=1, time=0)
    Context manager to put the terminal in cbreak mode.

Terminal I/O
------------

opentty(bufsize=-1, mode='r+b')
    Context manager returning a new rw stream connected to /dev/tty.
    The stream is None if the device cannot be opened.

readto(stream, endswith):
    Read bytes or characters from stream until buffer.endswith(endswith)
    is true.

High-level Functions
--------------------

getyx()
    Return the cursor position as 1-based (line, col) tuple.
    Line and col are 0 if the device cannot be opened or the terminal
    does not support DSR 6.

getfgcolor()
    Return the terminal foregound color as (r, g, b) tuple.
    All values are -1 if the device cannot be opened or does not supports
    OSC 10.

getbgcolor()
    Return the terminal background color as (r, g, b) tuple.
    All values are -1 if the device cannot be opened or does not supports
    OSC 11.

islightmode()
    Return true if the background color is lighter than the foreground color.
    May return None if the terminal does not support OSC color queries.

isdarkmode()
    Return true if the background color is darker than the foreground color.
    May return None if the terminal does not support OSC color queries.

Documentation
=============

Please see the `API Documentation`_ for more.

.. _`API Documentation`: https://term.readthedocs.io/en/stable/


Changelog
=========

2.5 - 2023-09-14
----------------

- Update tox.ini for latest tox.
  [stefan]

- Add .readthedocs.yaml file.
  [stefan]

- Pin sphinx and sphinx-rtd-theme versions in docs extra.
  [stefan]

- Add pylint extra which installs pylint.
  [stefan]

- Update .pylintrc for latest pylint.
  [stefan]

2.4 - 2022-03-07
----------------

- Add Python 3.8-3.10 to tox.ini. Remove old Python versions.
  [stefan]

- Replace deprecated ``python setup.py test`` in tox.ini.
  [stefan]

- Remove deprecated ``test_suite`` from setup.py.
  [stefan]

- Move metadata to setup.cfg and add a pyproject.toml file.
  [stefan]

- Include tests in sdist but not in wheel.
  [stefan]

- Fix escape sequence warning in byte string literal.
  [stefan]

- Open /dev/tty in binary mode under both Python 2 and 3.
  [stefan]

- Officially change opentty's bufsize argument default from 1 to -1.
  Under Python 3, 1 has effectively meant -1 all along but Python 3.8
  now issues a warning.
  [stefan]

- Add readto, getfgcolor, getbgcolor, islightmode, and isdarkmode.
  [stefan]

2.3 - 2019-02-08
----------------

- Add MANIFEST.in.
  [stefan]

- Release as wheel.
  [stefan]

- Drop explicit GPL because the PSF license is GPL-compatible anyway.
  [stefan]

2.2 - 2017-02-05
----------------

- Support Python 2.6-3.6 without 2to3.
  [stefan]

2.1 - 2014-04-19
----------------

- Remove setuptools from install_requires because it isn't.
  [stefan]

2.0 - 2012-04-27
----------------

- Open /dev/tty in binary mode under Python 3.
  [stefan]

- Disable buffering if the device is not seekable.
  [stefan]

- Remove getmaxyx since it cannot be implemented reliably.
  [stefan]

- Support Python 2.5.
  [stefan]

- Change license to GPL or PSF to avoid relicensing of PSF code.
  [stefan]

1.0 - 2012-04-11
----------------

- Initial release.
  [stefan]

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/stefanholek/term",
    "name": "term",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/term/",
    "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
    "maintainer_email": "",
    "keywords": "terminal,tty,setraw,setcbreak,opentty,readto,getyx,cursor position,escape sequence,lightmode,darkmode",
    "author": "Stefan H. Holek",
    "author_email": "stefan@epy.co.at",
    "download_url": "https://files.pythonhosted.org/packages/cf/04/9b149ac5e6e894f4dc29543d0bb227562171427d530e06ba4ad243bee17e/term-2.5.tar.gz",
    "platform": null,
    "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. It provides context managers for opening a terminal stream, and\nfor temporarily switching the terminal to raw or cbreak mode.\n\n.. _tty: https://docs.python.org/3/library/tty.html\n\nPackage Contents\n================\n\nTerminal Control\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\nTerminal I/O\n------------\n\nopentty(bufsize=-1, mode='r+b')\n    Context manager returning a new rw stream connected to /dev/tty.\n    The stream is None if the device cannot be opened.\n\nreadto(stream, endswith):\n    Read bytes or characters from stream until buffer.endswith(endswith)\n    is true.\n\nHigh-level Functions\n--------------------\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\ngetfgcolor()\n    Return the terminal foregound color as (r, g, b) tuple.\n    All values are -1 if the device cannot be opened or does not supports\n    OSC 10.\n\ngetbgcolor()\n    Return the terminal background color as (r, g, b) tuple.\n    All values are -1 if the device cannot be opened or does not supports\n    OSC 11.\n\nislightmode()\n    Return true if the background color is lighter than the foreground color.\n    May return None if the terminal does not support OSC color queries.\n\nisdarkmode()\n    Return true if the background color is darker than the foreground color.\n    May return None if the terminal does not support OSC color queries.\n\nDocumentation\n=============\n\nPlease see the `API Documentation`_ for more.\n\n.. _`API Documentation`: https://term.readthedocs.io/en/stable/\n\n\nChangelog\n=========\n\n2.5 - 2023-09-14\n----------------\n\n- Update tox.ini for latest tox.\n  [stefan]\n\n- Add .readthedocs.yaml file.\n  [stefan]\n\n- Pin sphinx and sphinx-rtd-theme versions in docs extra.\n  [stefan]\n\n- Add pylint extra which installs pylint.\n  [stefan]\n\n- Update .pylintrc for latest pylint.\n  [stefan]\n\n2.4 - 2022-03-07\n----------------\n\n- Add Python 3.8-3.10 to tox.ini. Remove old Python versions.\n  [stefan]\n\n- Replace deprecated ``python setup.py test`` in tox.ini.\n  [stefan]\n\n- Remove deprecated ``test_suite`` from setup.py.\n  [stefan]\n\n- Move metadata to setup.cfg and add a pyproject.toml file.\n  [stefan]\n\n- Include tests in sdist but not in wheel.\n  [stefan]\n\n- Fix escape sequence warning in byte string literal.\n  [stefan]\n\n- Open /dev/tty in binary mode under both Python 2 and 3.\n  [stefan]\n\n- Officially change opentty's bufsize argument default from 1 to -1.\n  Under Python 3, 1 has effectively meant -1 all along but Python 3.8\n  now issues a warning.\n  [stefan]\n\n- Add readto, getfgcolor, getbgcolor, islightmode, and isdarkmode.\n  [stefan]\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",
    "bugtrack_url": null,
    "license": "PSF-2.0",
    "summary": "An enhanced version of the tty module",
    "version": "2.5",
    "project_urls": {
        "Documentation": "https://term.readthedocs.io/en/stable/",
        "Homepage": "https://github.com/stefanholek/term"
    },
    "split_keywords": [
        "terminal",
        "tty",
        "setraw",
        "setcbreak",
        "opentty",
        "readto",
        "getyx",
        "cursor position",
        "escape sequence",
        "lightmode",
        "darkmode"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "217d589abff12d1bc6055f4152fdbe01cae374f81c051fcd3b7b8278eb437b1b",
                "md5": "b722fa7949527abac19dc77f917c9772",
                "sha256": "c775c7a6ed5ea85b0a659773756686b305e6079e9f2fa7bfcd2953d5d910f61f"
            },
            "downloads": -1,
            "filename": "term-2.5-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b722fa7949527abac19dc77f917c9772",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
            "size": 7442,
            "upload_time": "2023-09-14T13:36:46",
            "upload_time_iso_8601": "2023-09-14T13:36:46.954650Z",
            "url": "https://files.pythonhosted.org/packages/21/7d/589abff12d1bc6055f4152fdbe01cae374f81c051fcd3b7b8278eb437b1b/term-2.5-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf049b149ac5e6e894f4dc29543d0bb227562171427d530e06ba4ad243bee17e",
                "md5": "6177c20e0f7f0ce4cf9da7a3117754b7",
                "sha256": "846fda941dbb8a7c9f246e99bf5ee731910fc4a4cc54b7e36457c133c9f6b78b"
            },
            "downloads": -1,
            "filename": "term-2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "6177c20e0f7f0ce4cf9da7a3117754b7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
            "size": 16702,
            "upload_time": "2023-09-14T13:36:49",
            "upload_time_iso_8601": "2023-09-14T13:36:49.155681Z",
            "url": "https://files.pythonhosted.org/packages/cf/04/9b149ac5e6e894f4dc29543d0bb227562171427d530e06ba4ad243bee17e/term-2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-14 13:36:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stefanholek",
    "github_project": "term",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "term"
}
        
Elapsed time: 3.34187s