https://github.com/gau-nernst/lmdb-python
Another Python binding for LMDB. Built with Cython
https://github.com/gau-nernst/lmdb-python
cython lmdb python
Last synced: 2 months ago
JSON representation
Another Python binding for LMDB. Built with Cython
- Host: GitHub
- URL: https://github.com/gau-nernst/lmdb-python
- Owner: gau-nernst
- Created: 2022-04-24T08:39:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-28T17:34:11.000Z (over 2 years ago)
- Last Synced: 2025-02-14T01:18:23.941Z (8 months ago)
- Topics: cython, lmdb, python
- Language: Python
- Homepage:
- Size: 44.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LMDB Python
[](https://github.com/gau-nernst/lmdb-python/actions/workflows/build.yaml)
[](https://github.com/gau-nernst/lmdb-python/actions/workflows/wheels.yaml)
Another Python bindings for LMDB.
This repo serves as a practice for me to learn how to use 3rd-party C/C++ libraries in Python using Cython. The compiled C extension is statically linked against the master branch of OpenLDAP [here](https://git.openldap.org/openldap/openldap).
## Installation
From wheels:
```bash
pip install lmdb-python -f https://gau-nernst.github.io/lmdb-python/
```The following pre-built wheels are provided (64-bit only)
Platform | Architecture
---------|---------
Linux | manylinux: x86_64 and aarch64; musllinux: x86_64 and aarch64
macOS | x86_64 (Intel) and arm64 (Apple Silicon)
Windows | AMD64, x86, and ARM64Supported Python versions depend on [cibuildwheel](https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip). macOS arm64 is Python 3.8+, Windows ARM64 is Python 3.9+, and the rest are Python 3.6+.
Due to GHA runners' limitations, the following wheels are not tested, thus not guaranteed to work:
- musllinux_aarch64
- macosx_arm64
- win_arm64From source: Install directly from this GitHub repo
```bash
pip install git+https://github.com/gau-nernst/lmdb-python.git
```Alternatively, you can clone the repo locally and install from the local clone (remember to clone recursively to get OpenLDAP LMDB C source)
```bash
git clone --recursive https://github.com/gau-nernst/lmdb-python.git
cd lmdb-python
pip install .
```If you want to build against a specific version of LMDB, checkout the corresponding tag in the `openldap` submodule before installing the package
```bash
# assume you are inside 'lmdb-python' directory now
cd openldap
git checkout LMDB_0.9.30
```## Usage
```python
from lmdb_python import Databasedb = Database("test_db")
db.put(b"key", b"value")
assert db.get(b"key") == b"value"
```## Run tests
Install `pytest` using either `pip` or `conda`, then run it.
```bash
pytest -v
```