Python bindings for libtermkey
Project description
<!---
Copyright (c) 2019 Michael Vilim
This file is part of the pylibtermkey library. It is currently hosted at
https://github.com/mvilim/pylibtermkey
pylibtermkey is licensed under the MIT license. A copy of the license can be
found in the root folder of the project.
-->
## pylibtermkey
[![Build Status](https://travis-ci.org/mvilim/pylibtermkey.svg?branch=master)](https://travis-ci.org/mvilim/pylibtermkey)
pylibtermkey is a set of Python bindings for [libtermkey](http://www.leonerd.org.uk/code/libtermkey/), a library for interpreting terminal input. [Other Python bindings](https://github.com/temoto/ctypes_libtermkey) 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 = self.tk.waitkey()
print(res)
print(self.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](https://github.com/mvilim/pylibtermkey/blob/master/python/pylibtermkey/test_pylibtermkey.py) or the [libtermkey man pages](http://www.leonerd.org.uk/code/libtermkey/doc/).
### Building
To build this project:
```
python setup.py
```
### Unit tests
To run the unit tests:
```
python setup.py test
```
or use nose:
```
nosetests {project}/python/pylibtermkey
```
### Licensing
This project is licensed under the [MIT license](https://github.com/mvilim/pylibtermkey/blob/master/LICENSE). It uses the [pybind11](https://github.com/pybind/pybind11/) and [libtermkey](http://www.leonerd.org.uk/code/libtermkey/) projects whose licenses can be found in those [projects' directories](https://github.com/mvilim/pylibtermkey/blob/master/cpp/thirdparty).
Copyright (c) 2019 Michael Vilim
This file is part of the pylibtermkey library. It is currently hosted at
https://github.com/mvilim/pylibtermkey
pylibtermkey is licensed under the MIT license. A copy of the license can be
found in the root folder of the project.
-->
## pylibtermkey
[![Build Status](https://travis-ci.org/mvilim/pylibtermkey.svg?branch=master)](https://travis-ci.org/mvilim/pylibtermkey)
pylibtermkey is a set of Python bindings for [libtermkey](http://www.leonerd.org.uk/code/libtermkey/), a library for interpreting terminal input. [Other Python bindings](https://github.com/temoto/ctypes_libtermkey) 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 = self.tk.waitkey()
print(res)
print(self.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](https://github.com/mvilim/pylibtermkey/blob/master/python/pylibtermkey/test_pylibtermkey.py) or the [libtermkey man pages](http://www.leonerd.org.uk/code/libtermkey/doc/).
### Building
To build this project:
```
python setup.py
```
### Unit tests
To run the unit tests:
```
python setup.py test
```
or use nose:
```
nosetests {project}/python/pylibtermkey
```
### Licensing
This project is licensed under the [MIT license](https://github.com/mvilim/pylibtermkey/blob/master/LICENSE). It uses the [pybind11](https://github.com/pybind/pybind11/) and [libtermkey](http://www.leonerd.org.uk/code/libtermkey/) projects whose licenses can be found in those [projects' directories](https://github.com/mvilim/pylibtermkey/blob/master/cpp/thirdparty).
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
pylibtermkey-0.1.17.tar.gz
(645.7 kB
view hashes)
Built Distributions
Close
Hashes for pylibtermkey-0.1.17-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cc2826f0cb8a0e9a0eea406c34d67c6adfdea24e0fe9f5aab661a0fcc5a0eec |
|
MD5 | 242c464924e0823379be25439b720c18 |
|
BLAKE2b-256 | 48bb606dde071efa8ec4622d331385ce377a8cbf7ca170330729380b7a6d4d07 |
Close
Hashes for pylibtermkey-0.1.17-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b26e9dd6b32e8a7c72bbacaddcfa5ab9e3209abb28ef6e9f139fb1a061bc59d9 |
|
MD5 | 86a5a22beaaaaad57c8f411160d8e4b6 |
|
BLAKE2b-256 | 0acec0e017429caf15fb5d449ca0b9e71a326fdd2aa40809a2d049686bb47f06 |
Close
Hashes for pylibtermkey-0.1.17-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc8dd466f991512873ec89a86e3b23174b980c96bad8cdc2016d83ff3b0f09c4 |
|
MD5 | 58284e9571f94a15da871c1edc883070 |
|
BLAKE2b-256 | 53e444794aa66c72b964df6f5608e8141849ed4bd1c272236a9d8146a07b94c4 |
Close
Hashes for pylibtermkey-0.1.17-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b55bae8c41c4070f52d4ba6e033edd4787a82d481e900d676b85553ede73cc5 |
|
MD5 | 28ece3ff5023c6b338bc41dede7fff6a |
|
BLAKE2b-256 | b0dedb2d95cc6311a472811783e1ed5df277d522e1ea76e9b514febf88f9c045 |
Close
Hashes for pylibtermkey-0.1.17-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f5d48a866d073d7fa17f4c249718c454219c84c8dde84f35e12d37ef64b4d4e |
|
MD5 | afce4a9f80a085e760dfba32e1dc81f1 |
|
BLAKE2b-256 | 397a44117352d48d5a82e243c6bec9e3e1a3a2310a584b8299fb7f0cf959fd4d |
Close
Hashes for pylibtermkey-0.1.17-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b32083d4f154c3cb03cfd9ca9ed0a990ee35435f31a72dafd4297e1d73e68562 |
|
MD5 | 2c74b2373d1791bffd80ce4532fde25e |
|
BLAKE2b-256 | a26e87c7f801d5555a460f9267501ef1429d0d86713d6804e8e4a4175d56c6b9 |
Close
Hashes for pylibtermkey-0.1.17-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 568a0d61afc16df56cffdb29e5d4f77fce662368c8dad01d98da46d034bf9d3c |
|
MD5 | 5cf6511ebf6ecb971dcc455f0e7cf741 |
|
BLAKE2b-256 | 2c5ae535582b72cc08bd205bb8f325bfc048b71547a1bd0e352e79aa32145cf2 |
Close
Hashes for pylibtermkey-0.1.17-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4621c45d891fb85a6197737b58ded101dd93cfdb33675b0f1181a9db7ff5d4cb |
|
MD5 | fe7d94f878f8176e639509e5ee713a71 |
|
BLAKE2b-256 | adc59829b4262e4fcd188a5b735baa3abfc11103b7037572a1f8a72d26e0c39e |
Close
Hashes for pylibtermkey-0.1.17-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e8e6d2e0dce882ed7c038d597960e8a34097748ccca3a6f7c5d25f3592658ec |
|
MD5 | a45d3b6c241c951db91c5af32a2e20d9 |
|
BLAKE2b-256 | c798bb1308c7ab54bfc23f77bdcd162c1ef9f94547ddd36caf9bb930abd04ecf |
Close
Hashes for pylibtermkey-0.1.17-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61722cc297f16a8ea51c88a4292e3702fd11954f79961ac21dbb0231427effad |
|
MD5 | 143175d157e8d63e251dc36b35918529 |
|
BLAKE2b-256 | 9dc4bdd58b4fb0d4bb63236b4b27c00df3d9be4e78e28e9ef775e01643057ba7 |
Close
Hashes for pylibtermkey-0.1.17-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22d64cc0b01a57cb282afda1568a9cc85db314933cd12ede58797689fbc2d8e8 |
|
MD5 | f9d3312240a7367dc9d9e94582992dea |
|
BLAKE2b-256 | e0a56406541e4f5d8ac074f51518f23083022a5b315b464f86a5605c3cbf4f88 |
Close
Hashes for pylibtermkey-0.1.17-cp34-cp34m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 342b8a7acfd7e510cc03fb39822f8a323e2c631e001c3b79ed0b374997d44cda |
|
MD5 | c1a6582916e940c674eb832dc061f6af |
|
BLAKE2b-256 | 2efe9f0caa54a6b349cb40b1dc89275aad550c0a48e2ff6932023252c16db423 |