libvalkey
Python wrapper for libvalkey
What it is and what it does
libvalkey is a Python extension that wraps the C library libvalkey to speed up parsing of Valkey and Redis protocol replies. It provides a `Reader` class that buffers incoming data and parses RESP (Redis Serialization Protocol) replies incrementally. The extension is designed to integrate with Valkey/Redis client libraries to accelerate reply parsing, particularly for multi-bulk replies where the performance gains are most significant.
The package requires Python 3.9 or later and needs C compilation during installation, which means you need a C compiler and Python development headers available on your system. It has no runtime dependencies and is designed as a low-level parsing component rather than a standalone client library—it handles protocol parsing only and does not provide I/O functionality.
Use it for:
- Accelerate Valkey/Redis client performance when handling large multi-bulk replies like LRANGE results
- Integrate into custom Valkey/Redis client implementations that need faster protocol parsing
- Reduce latency in high-throughput Valkey/Redis workloads where reply parsing is a bottleneck
- Parse RESP protocol data with custom encoding support (UTF-8, etc.) and error handling
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
libvalkey is a Python C extension that accelerates parsing of Valkey/Redis protocol replies, particularly multi-bulk responses, by wrapping protocol parsing code from the libvalkey C library.
Yes, if you are using Valkey or Redis with Python and handle large multi-bulk replies. The performance gains are modest for simple operations (1.1x for SET/GET) but dramatic for larger replies (83.2x for LRANGE 0 999). Install friction is medium due to C compilation requirements. No security vulnerabilities and actively maintained. MIT license poses no restrictions.
Install
libvalkey on PyPI
pip
pip install libvalkeyuv
uv add libvalkeypoetry
poetry add libvalkeyInstalling libvalkey
Before you install
Medium install friction due to compiled C extension requiring build tools and Python development headers. Active maintenance with recent releases (27 days since last update); repository has low star count but is actively developed.
License in practice
MIT license is permissive; you can use this package freely in commercial and private projects without restriction or obligation to share modifications.
Quickstart
pip install libvalkey
import libvalkey
reader = libvalkey.Reader()
reader.feed(b"$5\r\nhello\r\n")
result = reader.gets()
print(result) # b'hello'
Requires C compiler (gcc) and Python development headers (python3-dev on Ubuntu/Debian). Python 3.9 or later required.
Verify before relying
- Whether performance improvements apply to your specific workload patterns and Valkey/Redis usage
- Compatibility with alternative Valkey/Redis client libraries beyond valkey-py
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 27 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 919,709/month — #4,720 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: libvalkey-4.1.0-cp310-cp310-macosx_11_0_arm64.whl; libvalkey-4.1.0-cp310-cp310-macosx_11_0_universal2.whl; libvalkey-4.1.0-cp310-cp310-macosx_11_0_x86_64.whl; libvalkey-4.1.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; libvalkey-4.1.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl; libvalkey-4.1.0-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl; libvalkey-4.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; libvalkey-4.1.0-cp310-cp310-musllinux_1_2_aarch64.whl; libvalkey-4.1.0-cp310-cp310-musllinux_1_2_ppc64le.whl; libvalkey-4.1.0-cp310-cp310-musllinux_1_2_s390x.whl; libvalkey-4.1.0-cp310-cp310-musllinux_1_2_x86_64.whl; libvalkey-4.1.0-cp310-cp310-win32.whl; libvalkey-4.1.0-cp310-cp310-win_amd64.whl; libvalkey-4.1.0-cp311-cp311-macosx_11_0_arm64.whl; libvalkey-4.1.0-cp311-cp311-macosx_11_0_universal2.whl; libvalkey-4.1.0-cp311-cp311-macosx_11_0_x86_64.whl; libvalkey-4.1.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; libvalkey-4.1.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl; libvalkey-4.1.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl; libvalkey-4.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Keywords: Valkey
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
hiredishiredis wraps the C hiredis library to parse…
permissive · top 1,000 on PyPI
valkeyPython client library for connecting to and…
permissive · top 5,000 on PyPI
fakeredisfakeredis provides an in-memory, pure-Python…
permissive · top 1,000 on PyPI
valkey-glideValkey GLIDE is an official async and sync…
permissive · top 5,000 on PyPI
opentelemetry-python-contrib-external-valkeyAdds OpenTelemetry tracing to the Valkey Python…
permissive · top 15,000 on PyPI
django-valkeyProvides a Valkey cache and session backend for…
permissive · top 15,000 on PyPI
py-key-value-aioProvides an async-only, pluggable key-value…
permissive · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
cachelibCacheLib provides a unified API for interacting…
permissive · top 5,000 on PyPI