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
[![PyPI Release](https://img.shields.io/pypi/v/pylibtermkey.svg)](https://pypi.org/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:
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](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
[![PyPI Release](https://img.shields.io/pypi/v/pylibtermkey.svg)](https://pypi.org/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:
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](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.2.2.tar.gz
(648.0 kB
view hashes)
Built Distributions
Close
Hashes for pylibtermkey-0.2.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5532103b2d404e8d3f5f585303de7902df2a170a76a65693e3cfb8675841e4ea |
|
MD5 | 0a41f663df83cb8cff10e9c75e55a84c |
|
BLAKE2b-256 | aeb4fef941dd6bfbcdd9fa2d7abd3da3b73786a5a911af667532a47a47e0d065 |
Close
Hashes for pylibtermkey-0.2.2-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82e0adcc9c932763ee6b5ccc6dad7846df69e62a0d0790c2ca9136d07ef3823b |
|
MD5 | 7407cccc0d38189ed8e1da0ad9904ce7 |
|
BLAKE2b-256 | dc55c68c63ae6a4f830dbee9cf006a75bd628049210ebda8d6332a6c15bc91ed |
Close
Hashes for pylibtermkey-0.2.2-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e500bf6fda44104066d1d94f31df7c882f87b6bf2430dbcb853618b750e0618 |
|
MD5 | c3a201d48cb989235be7af02b215a49a |
|
BLAKE2b-256 | 2ce0dc3ee0c02f25f0aa40ba0e0f38335f3b28fb15b4993c237ceea4b3fefbbb |
Close
Hashes for pylibtermkey-0.2.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbfa0d30620be12cee1189adcf8759256b56235c01914a3687157af1b6a3f9b0 |
|
MD5 | a204c6248c5797941c64e4d2b386d94c |
|
BLAKE2b-256 | 5fba99d380aa319ea7ca77bd43f08de8e7fab7f26fc1be8c9383a74e477734d3 |
Close
Hashes for pylibtermkey-0.2.2-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb5beb974327664fd5afd00c9d05e0c99814483bec29398646e458329c66223a |
|
MD5 | a36814ba0e5d6cabbf3e2574d763eb3c |
|
BLAKE2b-256 | cb1879b8cf743cf228737ffc438483b9b93a7de0877f86aee9edcf9f619ca68d |
Close
Hashes for pylibtermkey-0.2.2-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5102beae333c14ea45d0d2952fa1266e8716b1047a50c448dd9b59009a8dd847 |
|
MD5 | e985a7c383466f6bfee128f7a8716200 |
|
BLAKE2b-256 | 7680b3d5609675bdab5672a276cbd98eeb697420858420114d5a4fd8d3080e50 |
Close
Hashes for pylibtermkey-0.2.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 084e2ace8480c904aed49f3bec9f2ec43744194a566bd07fdf46d412cf8131f7 |
|
MD5 | ca428ce5ae8c1065081e76af927bd758 |
|
BLAKE2b-256 | 398575d5bf8d0c7ae538c4de0b0d2e76838ce0fb82362c6157e1feeb6a6b8624 |
Close
Hashes for pylibtermkey-0.2.2-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd67363b7cfd4977a59b8001473fa59121d188867d022ba8e963d30e8945da8d |
|
MD5 | a6f9bbdddb6c7b527f7fd06894b11d28 |
|
BLAKE2b-256 | 972bf128ae2ae00fe86b0c4314eab4f54a44bf7446e05e2b711fcd972c6568e2 |
Close
Hashes for pylibtermkey-0.2.2-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55aeb7e177df51783367c327890dead307594bb21e8811cdf5a93d65986f3226 |
|
MD5 | 23d0d085415e51b2751dfb28e3985c01 |
|
BLAKE2b-256 | 276e6526bf1aaf9409ddf4997fdcb4c234407b2c96eefa25155da21ed7d3de89 |
Close
Hashes for pylibtermkey-0.2.2-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 359e7608c269b75f19935b8d388eece11ff949acbf6b25612f31d489e3cecd11 |
|
MD5 | fd3f5427d403158336720eb8192cd964 |
|
BLAKE2b-256 | 866d0037c50429cf725ad5a74dea4d49f7b669eef4b49b38a85363f954ef4677 |
Close
Hashes for pylibtermkey-0.2.2-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64d352572bde19bee563624b68944d408f245dc277c0d8db4914a0f80323552b |
|
MD5 | ba6e01272bc5f786fd3a54f82927cdb8 |
|
BLAKE2b-256 | 842249989bbc064b796aba0c8e1faff6783a56c7efc4171aec52bb596cea1ebf |
Close
Hashes for pylibtermkey-0.2.2-cp34-cp34m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef9e178e641103e472d2259e216860f1531e736e4a5fd246a1648f48654e4806 |
|
MD5 | e2b0661bc067818067ac84549be02097 |
|
BLAKE2b-256 | a0d0f97f5d43578e8a6c3a5cba6ed9813dc4b9758b2b0f2eff7d1d503e6bb5c0 |