Name | python-yakh JSON |
Version |
0.4.1
JSON |
| download |
home_page | None |
Summary | Yet Another Keypress Handler |
upload_time | 2025-01-14 18:08:15 |
maintainer | None |
docs_url | None |
author | petereon |
requires_python | <4.0.0,>=3.7.8 |
license | MIT |
keywords |
python
keypress
key
keyboard
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# yakh
yakh (Yet Another Keypress Handler) tries to handle keypresses from the stdin in the terminal in high-level platform indepdendent manner.
## Installation
Yakh can be installed from [PyPI](https://pypi.org/project/python-yakh/) using,
```sh
pip install python-yakh
```
or GitHub itself using poetry,
```sh
poetry add git+https://github.com/petereon/yakh.git
```
## Usage
```python
from yakh import get_key
from yakh.key import Keys
key = ''
while key not in ['q', Keys.ENTER]:
key = get_key()
if key.is_printable:
print(key)
```
yakh is dead-simple, there is only one function `get_key()` which takes no arguments and blocks until a key is pressed.
For each keypress it creates an instance of [`Key`](./yakh/key/_key.py#L7) which holds:
- `.key`: characters representing the keypress
- `.key_codes`: collection of Unicode code point encodings for all the characters (given by `ord` function)
- `.is_printable`: printability of the characters in the keypress
Additionally `Key` instances
- are comparable with another `Key` instances, `str` instances and *Unicode code point* representations (tuples of integers)
- come with string representation for purposes of printing and string concatenation, which returns the content of `.key` attribute
## `yakh.key` submodule
`yakh.key` sub-module contains platform dependent representations of certain keys under `Keys` class. These are available namely for `CTRL` key combinations and some other common keys.
Full list of keys can be seen [here](./yakh/key/_key.py#L42) and [here](./yakh/key/_key.py#L81).
Raw data
{
"_id": null,
"home_page": null,
"name": "python-yakh",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.7.8",
"maintainer_email": null,
"keywords": "python, keypress, key, keyboard",
"author": "petereon",
"author_email": "pvyboch1@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d2/77/bbff0a1e6fb03b8cc2cc373a44cfbbb4fd22863c657f8630f4a0f5eb207c/python_yakh-0.4.1.tar.gz",
"platform": null,
"description": "# yakh\n\nyakh (Yet Another Keypress Handler) tries to handle keypresses from the stdin in the terminal in high-level platform indepdendent manner.\n\n## Installation\n\nYakh can be installed from [PyPI](https://pypi.org/project/python-yakh/) using,\n```sh\npip install python-yakh\n```\n\nor GitHub itself using poetry,\n```sh\npoetry add git+https://github.com/petereon/yakh.git\n```\n\n## Usage\n\n```python\nfrom yakh import get_key\nfrom yakh.key import Keys\n\nkey = ''\nwhile key not in ['q', Keys.ENTER]:\n key = get_key()\n if key.is_printable:\n print(key)\n```\n\nyakh is dead-simple, there is only one function `get_key()` which takes no arguments and blocks until a key is pressed.\n\nFor each keypress it creates an instance of [`Key`](./yakh/key/_key.py#L7) which holds:\n\n- `.key`: characters representing the keypress\n- `.key_codes`: collection of Unicode code point encodings for all the characters (given by `ord` function)\n- `.is_printable`: printability of the characters in the keypress\n\nAdditionally `Key` instances\n\n- are comparable with another `Key` instances, `str` instances and *Unicode code point* representations (tuples of integers)\n- come with string representation for purposes of printing and string concatenation, which returns the content of `.key` attribute\n\n## `yakh.key` submodule\n`yakh.key` sub-module contains platform dependent representations of certain keys under `Keys` class. These are available namely for `CTRL` key combinations and some other common keys. \n\nFull list of keys can be seen [here](./yakh/key/_key.py#L42) and [here](./yakh/key/_key.py#L81).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Yet Another Keypress Handler",
"version": "0.4.1",
"project_urls": {
"Repository": "https://github.com/petereon/yakh"
},
"split_keywords": [
"python",
" keypress",
" key",
" keyboard"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "224272571b24514b5f59c328f12e5294b246958951b889fac2bd5321e08a4bab",
"md5": "554ef83c58720caa99e76b3f9371f67b",
"sha256": "d69507e13e03d09cefd88030f74b6d5369b67de004be975a35be28eb286122e4"
},
"downloads": -1,
"filename": "python_yakh-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "554ef83c58720caa99e76b3f9371f67b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.7.8",
"size": 5826,
"upload_time": "2025-01-14T18:08:13",
"upload_time_iso_8601": "2025-01-14T18:08:13.618067Z",
"url": "https://files.pythonhosted.org/packages/22/42/72571b24514b5f59c328f12e5294b246958951b889fac2bd5321e08a4bab/python_yakh-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d277bbff0a1e6fb03b8cc2cc373a44cfbbb4fd22863c657f8630f4a0f5eb207c",
"md5": "6633fa282a8612e65a2dc3766fc0afff",
"sha256": "da03e800b4f2f5d85344f1668e852687c12dc1a99a03c65cf3dc13a3680da49d"
},
"downloads": -1,
"filename": "python_yakh-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "6633fa282a8612e65a2dc3766fc0afff",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.7.8",
"size": 3988,
"upload_time": "2025-01-14T18:08:15",
"upload_time_iso_8601": "2025-01-14T18:08:15.767232Z",
"url": "https://files.pythonhosted.org/packages/d2/77/bbff0a1e6fb03b8cc2cc373a44cfbbb4fd22863c657f8630f4a0f5eb207c/python_yakh-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-14 18:08:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "petereon",
"github_project": "yakh",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "python-yakh"
}