qbdiff


Nameqbdiff JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/synodriver/pyqbdiff
Summarypython binding for qbdiff
upload_time2024-02-03 15:03:08
maintainer
docs_urlNone
authorsynodriver
requires_python>=3.6
licenseBSD
keywords qbdiff delta path
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center"><i>✨ pyqbdiff ✨ </i></h1>

<h3 align="center">The python binding for <a href="https://github.com/kspalaiologos/qbdiff">qbdiff</a></h3>

[![pypi](https://img.shields.io/pypi/v/qbdiff.svg)](https://pypi.org/project/qbdiff/)
![python](https://img.shields.io/pypi/pyversions/qbdiff)
![implementation](https://img.shields.io/pypi/implementation/qbdiff)
![wheel](https://img.shields.io/pypi/wheel/qbdiff)
![license](https://img.shields.io/github/license/synodriver/pyqbdiff.svg)
![action](https://img.shields.io/github/workflow/status/synodriver/pyqbdiff/build%20wheel)

### 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
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/synodriver/pyqbdiff",
    "name": "qbdiff",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "qbdiff,delta,path",
    "author": "synodriver",
    "author_email": "diguohuangjiajinweijun@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b6/fe/aadc2bf300af9f42355e3aedc3ddb6fbf2067b62d4e698c6639a7a2776ad/qbdiff-0.0.1.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\"><i>\u2728 pyqbdiff \u2728 </i></h1>\r\n\r\n<h3 align=\"center\">The python binding for <a href=\"https://github.com/kspalaiologos/qbdiff\">qbdiff</a></h3>\r\n\r\n[![pypi](https://img.shields.io/pypi/v/qbdiff.svg)](https://pypi.org/project/qbdiff/)\r\n![python](https://img.shields.io/pypi/pyversions/qbdiff)\r\n![implementation](https://img.shields.io/pypi/implementation/qbdiff)\r\n![wheel](https://img.shields.io/pypi/wheel/qbdiff)\r\n![license](https://img.shields.io/github/license/synodriver/pyqbdiff.svg)\r\n![action](https://img.shields.io/github/workflow/status/synodriver/pyqbdiff/build%20wheel)\r\n\r\n### install\r\n```bash\r\npip install qbdiff\r\n```\r\n\r\n\r\n### Usage\r\n```python\r\nfrom qbdiff import compute, patch, version, error\r\n\r\nold = b\"1234\"\r\nnew_ = b\"123456\"\r\ncompute(old, new_, \"diff_tmp.bin\")\r\nwith open(\"diff_tmp.bin\", \"rb\") as f:\r\n    diff = f.read()\r\npatch(old, diff, \"new.bin\")\r\nwith open(\"new.bin\", \"rb\") as f:\r\n    newf = f.read()\r\nassert new_ == newf\r\n\r\n```\r\n- use ```QBDIFF_USE_CFFI``` env var to specify a backend\r\n\r\n### Public functions\r\n```python\r\nQBERR_BADCKSUM: int\r\nQBERR_BADPATCH: int\r\nQBERR_IOERR: int\r\nQBERR_LZMAERR: int\r\nQBERR_NOMEM: int\r\nQBERR_OK: int\r\nQBERR_SAIS: int\r\nQBERR_TRUNCPATCH: int\r\n\r\ndef version() -> str: ...\r\ndef error(code: int) -> str: ...\r\ndef compute(old: bytes, new_: bytes, diff_file: str) -> int: ...\r\ndef patch(old: bytes, patch_: bytes, new_file: str) -> int: ...\r\n```\r\n\r\n### Build\r\nTwo env var is needed to build, ```LIB``` and ```INCLUDE```. ```LIB``` is the path of liblzma.lib/liblzma.so,\r\nand ```INCLUDE``` is the directory of ```lzma.h```\r\n\r\n```bash\r\ngit submodule update --init --recursive\r\npython setup.py sdist bdist_wheel --use-cython --use-cffi\r\n```\r\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "python binding for qbdiff",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/synodriver/pyqbdiff"
    },
    "split_keywords": [
        "qbdiff",
        "delta",
        "path"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d26b0da8957d9275b2c2affbe074659b7f2599f6f93220cd6863af2e23dd277a",
                "md5": "ab1c46184cc01e0a0dac0f0a72ed119c",
                "sha256": "6432f0ef6fc7ba3e5d1cfb06cb917282f91af4ea300d43220bcacaf3d02a46b9"
            },
            "downloads": -1,
            "filename": "qbdiff-0.0.1-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "ab1c46184cc01e0a0dac0f0a72ed119c",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.6",
            "size": 389667,
            "upload_time": "2024-02-03T15:03:03",
            "upload_time_iso_8601": "2024-02-03T15:03:03.256432Z",
            "url": "https://files.pythonhosted.org/packages/d2/6b/0da8957d9275b2c2affbe074659b7f2599f6f93220cd6863af2e23dd277a/qbdiff-0.0.1-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b6feaadc2bf300af9f42355e3aedc3ddb6fbf2067b62d4e698c6639a7a2776ad",
                "md5": "b8541a1d016a73dfe9396dc055e060d2",
                "sha256": "59996d7e537dc1bcd4e17a8a6c8578cdd000947ec6a22bde8f69a9f1c17d0b2b"
            },
            "downloads": -1,
            "filename": "qbdiff-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b8541a1d016a73dfe9396dc055e060d2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 475981,
            "upload_time": "2024-02-03T15:03:08",
            "upload_time_iso_8601": "2024-02-03T15:03:08.380206Z",
            "url": "https://files.pythonhosted.org/packages/b6/fe/aadc2bf300af9f42355e3aedc3ddb6fbf2067b62d4e698c6639a7a2776ad/qbdiff-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-03 15:03:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "synodriver",
    "github_project": "pyqbdiff",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "qbdiff"
}
        
Elapsed time: 0.22260s