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:
```
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:
```
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.1.tar.gz
(646.6 kB
view hashes)
Built Distributions
Close
Hashes for pylibtermkey-0.2.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ae99da08667d86cfe741eff4833236f411fb7cfdb5856168644b2c030803ed7 |
|
MD5 | c9596b293bc9cee13085cf8c1d71634c |
|
BLAKE2b-256 | 6f12364c6d11b8f4e521cbe5b5ef15dd0ac08508e9cf9bd8e8d5bc9b8449f5cb |
Close
Hashes for pylibtermkey-0.2.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a677a4c007342f0701d5480257a147ea7917568fcb8e123ee7fcb3faa664f8e |
|
MD5 | b542cb7e04d8afccf06161d4eed430c4 |
|
BLAKE2b-256 | f120c86042a3ba4174fd6016035e35ced2771cd54dc68b121f59b1c659ef8b2b |
Close
Hashes for pylibtermkey-0.2.1-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a4eb95d79f1ee4ba82cd3401e5bbb01489a97d7c05cf1be5d528e9854137ed8 |
|
MD5 | fe8a6c7be5444d4a613a8da0013f2468 |
|
BLAKE2b-256 | b2bd51bcbacbe1e4048200cf522241459c462b58469a316dd64453ad4e9e87b2 |
Close
Hashes for pylibtermkey-0.2.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9c6db19be14c565602f70a8edc0fb35fd0584882888ae1a556c0e598119b43b |
|
MD5 | 036a84c64ad52288002e8c53b7ca3557 |
|
BLAKE2b-256 | 44095036e3a06344826dbe2d03f39fbe62a296236dbf79600657ecc7b51495a2 |
Close
Hashes for pylibtermkey-0.2.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 420c77c8d22b6869b36f92252217d9de33b1ad272190b0434c3eb75d7c652242 |
|
MD5 | f7d932601f46400d39ad4055aed774a7 |
|
BLAKE2b-256 | 437c50463dacb81fd76a3ca7b88a1ee957c56a4e4ef59a6e281098d31f51f88c |
Close
Hashes for pylibtermkey-0.2.1-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02335cd98f5b11bcbb9e1d3b9c288163d957d2b054383c60d2ab25bbc69a2e8c |
|
MD5 | acc4832160c2e05438b264742006407f |
|
BLAKE2b-256 | c730d34ee0b0fa5ab56d53c30428da545865931e3a409c67c1edf9d7281037bd |
Close
Hashes for pylibtermkey-0.2.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a61865c64975e7842c175edd5e37d761adb97dfa914f3ce75eebbe028ce2e81f |
|
MD5 | eadaf8537d9f9eb10f5f67f29c42e39e |
|
BLAKE2b-256 | 136cb60b8e0c36b58e66863551aa2ec9adf3f762b29764db4b030962b986e97a |
Close
Hashes for pylibtermkey-0.2.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbc6cae14d4da25f4862186ca701dd1dbb043bb666004756381423d358dbc368 |
|
MD5 | 87995bca0d9bee308f353811304989c9 |
|
BLAKE2b-256 | 6afe59e75ddba3479b031b78aa59e17644ee461d6ccdeb2b22cb00c937e539d4 |
Close
Hashes for pylibtermkey-0.2.1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 622250f78ae7c543c286d712f5cd898093cd9db7edb437cb4cee3407584df855 |
|
MD5 | 500b3449b1eb5f9abf6761d59ba0a72d |
|
BLAKE2b-256 | bed814174609b5e495cfbf7bbc3436cdb7a77941d28188b4e8a722bf3eff0cd9 |
Close
Hashes for pylibtermkey-0.2.1-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a59fc791f003a7ca657da07710762740f0d5a073c4854d9c0d311a0d3a13108e |
|
MD5 | fed9bc37e613c1c73acbfb22b3ed421e |
|
BLAKE2b-256 | cc31b3d1a5bbe16c3ef55061d8888a090a095534ef9d4224125ed4f834f0f64d |
Close
Hashes for pylibtermkey-0.2.1-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc05077bc9791a516c4d99870333987622e0b752e66fb11ff8f015de7782d74b |
|
MD5 | eefeedcb306043346ddc702b139228b1 |
|
BLAKE2b-256 | 78da802906893eeefc8ed6c8792cb683479f469455cee05d3f50d6bad76cdb81 |
Close
Hashes for pylibtermkey-0.2.1-cp34-cp34m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33dba91099fe49b65195e02ae126de3334a8dc2ce9d4746c5257d817264cc9ce |
|
MD5 | 8c8f8215c2cb8038479f6d817fa2be73 |
|
BLAKE2b-256 | ac793bddc253984e74f98b9c4f921068039ed682b60b3b095c3fe04a82d40641 |