Skip to main content

rime for python, attached to prompt-toolkit keybindings for some prompt-toolkit applications such as ptpython

Project description

pyrime

readthedocs pre-commit.ci status github/workflow codecov

github/downloads github/downloads/latest github/issues github/issues-closed github/issues-pr github/issues-pr-closed github/discussions github/milestones github/forks github/stars github/watchers github/contributors github/commit-activity github/last-commit github/release-date

github/license github/languages github/languages/top github/directory-file-count github/code-size github/repo-size github/v

pypi/status pypi/v pypi/downloads pypi/format pypi/implementation pypi/pyversions

aur/votes aur/popularity aur/maintainer aur/last-modified aur/version

screenshot

rime for python, attached to prompt-toolkit keybindings for some prompt-toolkit applications such as ptpython.

Dependence

# Ubuntu
sudo apt-get -y install librime-dev librime1 pkg-config
sudo apt-mark auto librime-dev pkg-config
# ArchLinux
sudo pacman -S --noconfirm librime pkg-config
# Android Termux
apt-get -y install librime pkg-config
# Nix
# use nix-shell to create a virtual environment then build
# homebrew
brew tap tonyfettes/homebrew-rime
brew install librime pkg-config
# Windows msys2
pacboy -S --noconfirm pkg-config librime gcc

Configure

~/.config/ptpython/config.py:

from ptpython.repl import PythonRepl
from prompt_toolkit.filters import EmacsInsertMode, ViInsertMode
from prompt_toolkit.key_binding.key_processor import KeyPressEvent
from pyrime.ptpython.plugins import RIME


def configure(repl: PythonRepl) -> None:
    rime = RIME(repl)

    @repl.add_key_binding("c-^", filter=ViInsertMode())
    @repl.add_key_binding("c-^", filter=EmacsInsertMode())
    @repl.add_key_binding("c-^", filter=rime.mode())
    def _(event: KeyPressEvent) -> None:
        rime.toggle()

If you defined some key bindings which will disturb rime, try:

    @repl.add_key_binding("c-h", filter=rime.filter(EmacsInsertMode()))
    def _(event: KeyPressEvent) -> None:
        rime.toggle()

If you want to exit rime in ViNavigationMode(), try:

    @repl.add_key_binding("escape", filter=EmacsInsertMode())
    def _(event: KeyPressEvent) -> None:
        """.

        :param event:
        :type event: KeyPressEvent
        :rtype: None
        """
        event.app.editing_mode = EditingMode.VI
        event.app.vi_state.input_mode = InputMode.NAVIGATION
        rime.conditional_disable()

    # and a, I, A, ...
    @repl.add_key_binding("i", filter=ViNavigationMode())
    def _(event: KeyPressEvent) -> None:
        """.

        :param event:
        :type event: KeyPressEvent
        :rtype: None
        """
        event.app.editing_mode = EditingMode.EMACS
        event.app.vi_state.input_mode = InputMode.INSERT
        rime.conditional_enable()

It will remember rime status and enable it when reenter ViInsertMode() or EmacsInsertMode().

Some utility functions are defined in this project. Refer my ptpython config to know more.

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

pyrime-0.0.11.tar.gz (46.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyrime-0.0.11-pp311-pypy311_pp73-macosx_15_0_arm64.whl (1.2 MB view details)

Uploaded PyPymacOS 15.0+ ARM64

pyrime-0.0.11-cp313-cp313-win_amd64.whl (98.1 kB view details)

Uploaded CPython 3.13Windows x86-64

pyrime-0.0.11-cp313-cp313-musllinux_1_2_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

pyrime-0.0.11-cp313-cp313-musllinux_1_2_s390x.whl (2.6 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ s390x

pyrime-0.0.11-cp313-cp313-musllinux_1_2_ppc64le.whl (2.5 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ ppc64le

pyrime-0.0.11-cp313-cp313-musllinux_1_2_i686.whl (2.5 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ i686

pyrime-0.0.11-cp313-cp313-musllinux_1_2_armv7l.whl (2.0 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ ARMv7l

pyrime-0.0.11-cp313-cp313-musllinux_1_2_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ ARM64

pyrime-0.0.11-cp313-cp313-manylinux_2_17_x86_64.whl (70.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pyrime-0.0.11-cp313-cp313-macosx_15_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

pyrime-0.0.11-cp312-cp312-musllinux_1_2_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

pyrime-0.0.11-cp312-cp312-musllinux_1_2_s390x.whl (2.6 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ s390x

pyrime-0.0.11-cp312-cp312-musllinux_1_2_ppc64le.whl (2.5 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ppc64le

pyrime-0.0.11-cp312-cp312-musllinux_1_2_i686.whl (2.5 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ i686

pyrime-0.0.11-cp312-cp312-musllinux_1_2_armv7l.whl (2.0 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARMv7l

pyrime-0.0.11-cp312-cp312-musllinux_1_2_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

pyrime-0.0.11-cp312-cp312-macosx_15_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

pyrime-0.0.11-cp311-cp311-musllinux_1_2_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

pyrime-0.0.11-cp311-cp311-musllinux_1_2_s390x.whl (2.6 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ s390x

pyrime-0.0.11-cp311-cp311-musllinux_1_2_ppc64le.whl (2.5 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ ppc64le

pyrime-0.0.11-cp311-cp311-musllinux_1_2_i686.whl (2.5 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ i686

pyrime-0.0.11-cp311-cp311-musllinux_1_2_armv7l.whl (2.0 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ ARMv7l

pyrime-0.0.11-cp311-cp311-musllinux_1_2_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ ARM64

pyrime-0.0.11-cp311-cp311-macosx_15_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file pyrime-0.0.11.tar.gz.

File metadata

  • Download URL: pyrime-0.0.11.tar.gz
  • Upload date:
  • Size: 46.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyrime-0.0.11.tar.gz
Algorithm Hash digest
SHA256 b63ed7dcfdc3f43888a337e2a17eacdc7eda06a45d458666be9062fdc689877d
MD5 dbeb42b3aaa681090520ac36f1384376
BLAKE2b-256 5f959efded8a8d69d895ca05f5ef7651e4a28c7972e874e29855bbbe0ee98588

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-pp311-pypy311_pp73-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-pp311-pypy311_pp73-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b7eaf90db9b17d062e01afcc90d4b9c89400dd1493f29b05e0148dea6469113d
MD5 62b7da54656d212f0f8664572f62f77c
BLAKE2b-256 0a107d11ffe311e7a7e4db30cdc86dd31414c49306f20178986ef67fbbd222e5

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pyrime-0.0.11-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 98.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyrime-0.0.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cb0fc0ef13026f9e812a17f11c848fe46695ee033fb2fd537b7302b0b0064423
MD5 1bbcd2e53c58b55d8b75632f094f0987
BLAKE2b-256 f7078606c806aa97d0bd3935de9cb511c4bcff2bc087b82005540755f1663bff

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0edbef4acda896de1a164959dabce4ae2700c660a1f7be3aa1c9287276bd9c6a
MD5 c5ed755785756017308b75d88be1862c
BLAKE2b-256 547fc9b2629f62f9a43024489765c6f94b46da3cbb8198531cbbf0419ccafe5c

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp313-cp313-musllinux_1_2_s390x.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp313-cp313-musllinux_1_2_s390x.whl
Algorithm Hash digest
SHA256 06e6f5f1871ebf71b7e9f58f95321bc13099ac71cc0da57ccc427b51dac588fe
MD5 6d8efa14311bbda0337204365e0defc7
BLAKE2b-256 573dae3c43bb674de01eeeaafb6ba28a43e9c7bbf0900b82ccaa6b4b4f8f4c72

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp313-cp313-musllinux_1_2_ppc64le.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp313-cp313-musllinux_1_2_ppc64le.whl
Algorithm Hash digest
SHA256 cb7afe7213f04cfbc8caac627baa07fc20e8e7ba10037fc94691de29115d8538
MD5 aaa51f471b436ff23763711aa6e2aa5b
BLAKE2b-256 dde88b994c25063291095a82a98ae24699e2b0778423667b2fd6cf1c06be57c6

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp313-cp313-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp313-cp313-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 474d9d20187c4cef27ffc41bfb2f848709575862ba21f8c25e486638a906653d
MD5 e8bed9dcbd5dde800f7478f9ef1e7834
BLAKE2b-256 5fb0b572c4648b41c8d7d519205451a154a367d45fe747a9d68f30baf91f60d8

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp313-cp313-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp313-cp313-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 420b31c9044633caefb3438931bd5a9f7e307dd7c8191e3ddc5cab557def108d
MD5 ac7c257d84b3c5a7b49d17a5143ce630
BLAKE2b-256 dbe1dfc40e4a969363d883fc3eb310d9a121445b61dbe02ae3de15964d0521bf

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp313-cp313-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 93c4b88face5fa2a2fb2a04649fe03f8cddbc3be72ebbdfe9e64ec3a5f8dbf40
MD5 97cb132b17271a0c537ab151e597e69e
BLAKE2b-256 e282d8ca3ea82c177ff5f70ced7acdc59674bb73e558f560b323fcd310b02c08

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 98e6ca47534ec089b81d449e1c7b8fe6156114b20e433bf2dbdc45a1d47ba869
MD5 595d420078744ec175b0e6f00d8ac0eb
BLAKE2b-256 1bc14d0fa871e2bbf77b8a1d7f8655144cd7696e50421e4fedaef8bda514c809

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 59cb5dcc35da8628a7e33edde70d791f7763d4d615e626f8e86d121702e75f0d
MD5 2b7168ad3e6480e40e9d61a2739632c2
BLAKE2b-256 82f96202ac2b5ca457ad9b14d0b9bdbf599d0be652313b2896fe72adb3881b46

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fd02ec6fdd67e5b01ff688c0abce23978b48a5f61d5e3ed758be773acef6164f
MD5 f38834a680f65a8ac993f1f75674cdb1
BLAKE2b-256 090e6970c0b167734d83a57a448b611331f1ec0a463ef11ce0c23881b5a55fb7

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp312-cp312-musllinux_1_2_s390x.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp312-cp312-musllinux_1_2_s390x.whl
Algorithm Hash digest
SHA256 6148ab7b871fdf58650b43bae0f194106656d394382c1ed751e26f7b1bad3fba
MD5 99def9a9f4891276089e50404377ee62
BLAKE2b-256 3a7bd8cd7c3a47646c7f34c6bf4442b372d11be1bce640b47d31b0e356381768

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp312-cp312-musllinux_1_2_ppc64le.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp312-cp312-musllinux_1_2_ppc64le.whl
Algorithm Hash digest
SHA256 da259b779ded6362ece2e55503d17321ddb00ea2492d580e3a1ac8e08af2d8fc
MD5 7b406069a0c04c209d64954a0aa3d906
BLAKE2b-256 03dec2f57aa0489d136ca0cd7076bf082b1a1ec7f863a66a04f01742d5a3486c

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp312-cp312-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp312-cp312-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 5cf688b108e99471eb7512b8c5db1d4a99ec2d8beecfd4d1e5a577d293674296
MD5 a191a446ab6c3ca3baabfee46e99a896
BLAKE2b-256 a2ed94c97f62a18de574f4894aa33d1fa6c2c3a71631278a30c075e31c84b890

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp312-cp312-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp312-cp312-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 2819d0c1b010fb3927c94d3d5ce0dd3a3fa3fad9da652c05dfd2cc9c5b382f0c
MD5 6d4c42a4da868397fb7170f0607e3b41
BLAKE2b-256 e80c73c09270e293b1f17b16196df422921e72602333b9d0d643c829e41ec591

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp312-cp312-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a61ed6bc07e3f3c999ee840041866c73daf429c8abfc13c29e8df4f910bbd847
MD5 874917d1f62e88402a867cb933e36f34
BLAKE2b-256 6c22f7a1c1896db128fbcf8fbbab4689897b2cf4f11f5afd7965e6ffcbb60f16

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 93cdb1f0e918f60d6a3e405ea60bd006547e6df0a743c059d0b73fa31cec85e1
MD5 80e3fdf66ec10cad722e54ef42e03ad6
BLAKE2b-256 9343b04eae40a7ca2960620edf0390805709204338e5f85a446ab54bde8389c3

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 348b4a0dbb63b4a4c80f41f308cdbd19a1cf2562eecd62a8687ff299f7109647
MD5 2dfb348fb03fb23479485a4244bb9014
BLAKE2b-256 736c21b8e48a5a1086a97d813db890e14128039187de227f576b4c59ec503b0c

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp311-cp311-musllinux_1_2_s390x.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp311-cp311-musllinux_1_2_s390x.whl
Algorithm Hash digest
SHA256 0aaa262714403342b7047ce9561f60608a8dd57442fc425220cd3bab9de4b1ab
MD5 ca1c761b0bd5f9e2e1b117395e47249c
BLAKE2b-256 069be7c2e1901fffa14a28d3402248665c32152cedad3c1fdde526801fdab1ba

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp311-cp311-musllinux_1_2_ppc64le.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp311-cp311-musllinux_1_2_ppc64le.whl
Algorithm Hash digest
SHA256 751171ae3285f863386f0955c691dffe79785ba00ae0b16e7351d29207f23f95
MD5 b45dc8910c495603fcec9a5efc633361
BLAKE2b-256 28ef76c64cbe1d77c8b2803144a36c98cdb58a457e75a5224471f30ff0ec7caa

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp311-cp311-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp311-cp311-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 5614c34e0cd4f614d6ac7bb0613d88ae78b178117861cebd13ac0a83e0d45041
MD5 5bb080bfc3b2aec6d082a9e06934a4b5
BLAKE2b-256 fc28979e9525b1eec9a042b6cffe1f335ef5d241001dbc1e5d79febf5af7bc06

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp311-cp311-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp311-cp311-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 eb8d10ba30c8a04d003a5e888b334f6398bc9ebbf376c46fdfa50adcda04adc0
MD5 5fb56235fc083c68deb667ed1b7d2a23
BLAKE2b-256 e6d02d1246eef76f3f78e3f6193d28b27ff044d5c33957de9d3b66d2b8f2531b

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp311-cp311-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp311-cp311-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 36761722c8665d2cd2825548b9540e100fe23a1c70205372f3f95ef6bc8a82a5
MD5 1ba1c6894fe6438c952e731fe00c8a54
BLAKE2b-256 265608492fc87337fa4da09f0c4c4fa1fa7bd141965d0d8412b5e789e9fad661

See more details on using hashes here.

File details

Details for the file pyrime-0.0.11-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pyrime-0.0.11-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 f3d9bdc4f03015b612e5dcad7ea5dd3c4055452aef660a7c627e4ea8afb528d4
MD5 cef584b701aaf1dc81d1c1fb38bc15ec
BLAKE2b-256 10e258f3a9f2ea0194885ce73d4cc94145128aea2cd551b911e22f6ff8b24249

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page