Python bindings for libtermkey
Project description
pylibtermkey
pylibtermkey is a set of Python bindings for libtermkey, a library for interpreting terminal input. Other Python bindings are out of date and not easily installable. This project has a few differences:
- libtermkey is automatically built as part of this project
- pybind11 is used for easy binding
- unit tests are included
- precompiled wheels are built from this repo and available on PyPI
Installation
To install from PyPI:
pip install pylibtermkey
Example
A minimal example of obtaining a keystroke and printing the results:
import pylibtermkey_cpp as termkey
tk = termkey.TermKey()
res, key = tk.waitkey()
print(res)
print(tk.strfkey(key, termkey.TermKeyFormat.VIM)
Note that, by default, termkey will read from stdin causing python terminal to not display typed characters. It is best to use termkey in an pre-written script rather in a REPL setup (as you will not be able to see what you are typing once termkey is active).
For other features, see the tests or the libtermkey man pages.
Building
To build this project:
Building from source requires cmake (pip install cmake).
python setup.py
Unit tests
To run the unit tests:
python setup.py test
or use nose:
nosetests python/pylibtermkey
Licensing
This project is licensed under the MIT license. It uses the pybind11 and libtermkey projects whose licenses can be found in those projects' directories.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylibtermkey-0.3.1.tar.gz.
File metadata
- Download URL: pylibtermkey-0.3.1.tar.gz
- Upload date:
- Size: 647.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd8d54300daf55555ba2567921d288496ccca8521392465943745214d0ac72ff
|
|
| MD5 |
f846933551b01364a40af2c110a08735
|
|
| BLAKE2b-256 |
83d5731244efe29f5fa17b921cb2efcb41a8257db2a7977a4183ccb30465cb74
|
File details
Details for the file pylibtermkey-0.3.1-cp38-cp38-manylinux2014_x86_64.whl.
File metadata
- Download URL: pylibtermkey-0.3.1-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 299.1 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d9a0640a7501bd04e2731dd83fe5df6d1205f37482e44dd15cb641bb1683892
|
|
| MD5 |
818562833a9628f7ae622d0652ad68c8
|
|
| BLAKE2b-256 |
2405a4b54f4256e638a51977d8eb2aa1b17fda9b131e31d6ef19df3f4c27ceb9
|
File details
Details for the file pylibtermkey-0.3.1-cp38-cp38-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pylibtermkey-0.3.1-cp38-cp38-macosx_10_13_x86_64.whl
- Upload date:
- Size: 124.3 kB
- Tags: CPython 3.8, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d9517c1ab923dcba8ef6f7f28347ce54e3b198cded90de6430ffb368353398b
|
|
| MD5 |
6a4edf57fec6a5d40d7adbc749a5ae0c
|
|
| BLAKE2b-256 |
f348818fcd9a4b2498d9136ef837651fd56dee04848b271d713f73832680f79c
|
File details
Details for the file pylibtermkey-0.3.1-cp37-cp37m-manylinux2014_x86_64.whl.
File metadata
- Download URL: pylibtermkey-0.3.1-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 300.5 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b6ffbf8ab3067f5170480808f5e04f7d46ef781c5dd61faf70353b6413ff3df
|
|
| MD5 |
5eb9c745ad6aa2ab71f9dbc1c5137e7f
|
|
| BLAKE2b-256 |
1480f44fcdd96227acba11a90038f71a0543e02d045c1f39bb6d2ff1b1134fba
|
File details
Details for the file pylibtermkey-0.3.1-cp37-cp37m-macosx_10_13_intel.whl.
File metadata
- Download URL: pylibtermkey-0.3.1-cp37-cp37m-macosx_10_13_intel.whl
- Upload date:
- Size: 120.8 kB
- Tags: CPython 3.7m, macOS 10.13+ Intel (x86-64, i386)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4abbeddea0ebd36ad2b648077ae352604e271a3855a18565ea61d5b36437885
|
|
| MD5 |
1b444ab563d7dd382f24bf5cad9c4e78
|
|
| BLAKE2b-256 |
d29ee535408b20d45720d88d79c2497cfbbb88683dc220665cc4c7dbf5463b31
|
File details
Details for the file pylibtermkey-0.3.1-cp36-cp36m-manylinux2014_x86_64.whl.
File metadata
- Download URL: pylibtermkey-0.3.1-cp36-cp36m-manylinux2014_x86_64.whl
- Upload date:
- Size: 300.4 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1261eb4a3971c29e3e7bb923a6c9d9b86c91af53450440dd1b38419da8fdf210
|
|
| MD5 |
bc48a5ff1cd4dd52c896869c4c990018
|
|
| BLAKE2b-256 |
0781a9b278e7c01110cba32db4e05dada7151a9562ad4e1d7416021fa0482159
|
File details
Details for the file pylibtermkey-0.3.1-cp36-cp36m-macosx_10_13_intel.whl.
File metadata
- Download URL: pylibtermkey-0.3.1-cp36-cp36m-macosx_10_13_intel.whl
- Upload date:
- Size: 120.7 kB
- Tags: CPython 3.6m, macOS 10.13+ Intel (x86-64, i386)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd5dbd45269d1d74c540bdd72b028bedaa02383d5f19eb9c6f0e7a91149a9df5
|
|
| MD5 |
d168c356e0b90e91cb477020da18b071
|
|
| BLAKE2b-256 |
83737349e71715f0dfdcaa4b7f9188472c2478bbd613dd3eed7dde3c9152f4f7
|
File details
Details for the file pylibtermkey-0.3.1-cp35-cp35m-manylinux2014_x86_64.whl.
File metadata
- Download URL: pylibtermkey-0.3.1-cp35-cp35m-manylinux2014_x86_64.whl
- Upload date:
- Size: 300.4 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd9614397b10ccc1f1dffe53df3367845c6fdb37c615a07800c966ccd0030753
|
|
| MD5 |
a3d7cbac2db542606714b198f4cafe60
|
|
| BLAKE2b-256 |
6383152d2f140db90ef1134999a068e3e640096181f2c8ffbbe37886da253985
|
File details
Details for the file pylibtermkey-0.3.1-cp35-cp35m-macosx_10_13_intel.whl.
File metadata
- Download URL: pylibtermkey-0.3.1-cp35-cp35m-macosx_10_13_intel.whl
- Upload date:
- Size: 120.7 kB
- Tags: CPython 3.5m, macOS 10.13+ Intel (x86-64, i386)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3125e22b2fc974dcdc17e2ad633b8abcb5b41018fbbc177b85b15f49bcbfd335
|
|
| MD5 |
e9e13c83aa95a187b39845fd4963a801
|
|
| BLAKE2b-256 |
9d25883f3f1fc39def16200e89979e5b32d3c7e6b78c5f930f4c1525e8f88423
|