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 using,
pip install python-yakh
or GitHub itself using poetry,
poetry add git+https://github.com/petereon/yakh.git
Usage
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 which holds:
.key: characters representing the keypress.key_codes: collection of Unicode code point encodings for all the characters (given byordfunction).is_printable: printability of the characters in the keypress
Additionally Key instances
- are comparable with another
Keyinstances,strinstances and Unicode code point representations (tuples of integers) - come with string representation for purposes of printing and string concatenation, which returns the content of
.keyattribute
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.
Metadata
Release files for python-yakh 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python_yakh-0.4.2.tar.gz | 4.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_yakh-0.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.0 kB
Release files / python_yakh-0.4.2.tar.gz
| Download URL | python_yakh-0.4.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c4b73e8e8ba8f36ca53ed963a3a035f0e11bfa429b807c9aca58105cfd151c0
|
|
BLAKE2b-256 checksum How to use checksums |
a0e5dc0206d318ca7506624daba9460000818585e61bbe1797f2614e0dda847f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / python_yakh-0.4.2-py3-none-any.whl
| Download URL | python_yakh-0.4.2-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2aaecaada368a164e8bf334f9ebf7c565406f303ce4fea9f5d19311a3418e04f
|
|
BLAKE2b-256 checksum How to use checksums |
4fac5c55846a02aaa9b419e3128342afa24a0e8c33c538b962e747596560d2dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for python-yakh 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.