https://github.com/synodriver/pyqbdiff
python binding for qbdiff
https://github.com/synodriver/pyqbdiff
Last synced: 12 months ago
JSON representation
python binding for qbdiff
- Host: GitHub
- URL: https://github.com/synodriver/pyqbdiff
- Owner: synodriver
- Created: 2023-10-15T12:32:49.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-26T04:43:58.000Z (over 1 year ago)
- Last Synced: 2025-06-12T09:49:47.592Z (12 months ago)
- Language: Python
- Size: 390 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- Changelog: changename.py
Awesome Lists containing this project
README
✨ pyqbdiff ✨
The python binding for qbdiff
[](https://pypi.org/project/qbdiff/)





### install
```bash
pip install qbdiff
```
### Usage
```python
from qbdiff import compute, patch, version, error
old = b"1234"
new_ = b"123456"
compute(old, new_, "diff_tmp.bin")
with open("diff_tmp.bin", "rb") as f:
diff = f.read()
patch(old, diff, "new.bin")
with open("new.bin", "rb") as f:
newf = f.read()
assert new_ == newf
```
- use ```QBDIFF_USE_CFFI``` env var to specify a backend
### Public functions
```python
QBERR_BADCKSUM: int
QBERR_BADPATCH: int
QBERR_IOERR: int
QBERR_LZMAERR: int
QBERR_NOMEM: int
QBERR_OK: int
QBERR_SAIS: int
QBERR_TRUNCPATCH: int
def version() -> str: ...
def error(code: int) -> str: ...
def compute(old: bytes, new_: bytes, diff_file: str) -> int: ...
def patch(old: bytes, patch_: bytes, new_file: str) -> int: ...
```
### Build
Two env var is needed to build, ```LIB``` and ```INCLUDE```. ```LIB``` is the path of liblzma.lib/liblzma.so,
and ```INCLUDE``` is the directory of ```lzma.h```
```bash
git submodule update --init --recursive
python setup.py sdist bdist_wheel --use-cython --use-cffi
```