python-kv


Namepython-kv JSON
Version 0.2.14 PyPI version JSON
download
home_pageNone
SummaryAsync, exception-free key-value store ABC. Implementations over SQLAlchemy, the filesystem, Redis, Azure Blob, and more.
upload_time2024-08-20 19:42:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # KV

> Async, exception-free key-value store ABC. Implementations over SQLAlchemy, the filesystem, Redis, Azure Blob, and more.

```bash
pip install python-kv
```

## Usage

```python
from kv import KV

kv = KV.of('sql+sqlite:///path/to/db.sqlite') # easiest way to switch backends: connection strings

await kv.insert('key', 'value') # Left[DBError] | Right[None]
await kv.read('key') # Left[ReadError] | Right['value']
await kv.delete('key') # Left[DBError] | Right[None]
[k async for k in kv.keys()] # list[Left[ReadError] | Right[T]]
[it async for it in kv.items()] # list[Left[ReadError] | Right[tuple[str, T]]]
await kv.clear() # Left[DBError] | Right[None]
# and a few more
```

## Serialization & Validation
  
```python
from dataclasses import dataclass

@dataclass
class MySerializableType:
  a: int
  b: str

kv = KV.of('sql+sqlite://...', MySerializableType)
await kv.insert('key', MySerializableType(1, '2')) # Left[InvalidData] | Right[None]
# etc.
```

## CLI
  
```bash
kv serve 'file://data' --token "shhhhh" --port 8080 --type dict
kv serve 'sql+postgresql+psycop2g://...' --port 8081 --type str
```

```bash
kv copy -i 'file://data' -o 'sql+sqlite:///path/to/db.sqlite' -v
kv copy -i 'https://my.com/data' -o 'sql+sqlite:///path/to/db.sqlite'
```


```bash
kv test CONN_STR # runs some basic tests
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-kv",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Marcel Claramunt <marcel@moveread.com>",
    "download_url": "https://files.pythonhosted.org/packages/df/0d/c37b5e4369cca225b7a957f6b15cd4e66201a800c2a36c290e796e90a153/python_kv-0.2.14.tar.gz",
    "platform": null,
    "description": "# KV\n\n> Async, exception-free key-value store ABC. Implementations over SQLAlchemy, the filesystem, Redis, Azure Blob, and more.\n\n```bash\npip install python-kv\n```\n\n## Usage\n\n```python\nfrom kv import KV\n\nkv = KV.of('sql+sqlite:///path/to/db.sqlite') # easiest way to switch backends: connection strings\n\nawait kv.insert('key', 'value') # Left[DBError] | Right[None]\nawait kv.read('key') # Left[ReadError] | Right['value']\nawait kv.delete('key') # Left[DBError] | Right[None]\n[k async for k in kv.keys()] # list[Left[ReadError] | Right[T]]\n[it async for it in kv.items()] # list[Left[ReadError] | Right[tuple[str, T]]]\nawait kv.clear() # Left[DBError] | Right[None]\n# and a few more\n```\n\n## Serialization & Validation\n  \n```python\nfrom dataclasses import dataclass\n\n@dataclass\nclass MySerializableType:\n  a: int\n  b: str\n\nkv = KV.of('sql+sqlite://...', MySerializableType)\nawait kv.insert('key', MySerializableType(1, '2')) # Left[InvalidData] | Right[None]\n# etc.\n```\n\n## CLI\n  \n```bash\nkv serve 'file://data' --token \"shhhhh\" --port 8080 --type dict\nkv serve 'sql+postgresql+psycop2g://...' --port 8081 --type str\n```\n\n```bash\nkv copy -i 'file://data' -o 'sql+sqlite:///path/to/db.sqlite' -v\nkv copy -i 'https://my.com/data' -o 'sql+sqlite:///path/to/db.sqlite'\n```\n\n\n```bash\nkv test CONN_STR # runs some basic tests\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Async, exception-free key-value store ABC. Implementations over SQLAlchemy, the filesystem, Redis, Azure Blob, and more.",
    "version": "0.2.14",
    "project_urls": {
        "repo": "https://github.com/marciclabas/kv.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8e093dffbfda8a4fda42b3e35f8e6919df2d10a4ce08de2956cb143d2b66786f",
                "md5": "e3c8afc6249af2d383ab256ae4c9a00c",
                "sha256": "411ebe6245f416bc6fce0d77ce94e3ccaab152b07b8ba9e6e8cc69612d98bea2"
            },
            "downloads": -1,
            "filename": "python_kv-0.2.14-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3c8afc6249af2d383ab256ae4c9a00c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 28760,
            "upload_time": "2024-08-20T19:42:42",
            "upload_time_iso_8601": "2024-08-20T19:42:42.611886Z",
            "url": "https://files.pythonhosted.org/packages/8e/09/3dffbfda8a4fda42b3e35f8e6919df2d10a4ce08de2956cb143d2b66786f/python_kv-0.2.14-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df0dc37b5e4369cca225b7a957f6b15cd4e66201a800c2a36c290e796e90a153",
                "md5": "84a259e418e5772b7576811ffb8a6164",
                "sha256": "a4f3614bfdc0344eed861fddebea3e3fc2712143575c80c3f4323d2fa5986dce"
            },
            "downloads": -1,
            "filename": "python_kv-0.2.14.tar.gz",
            "has_sig": false,
            "md5_digest": "84a259e418e5772b7576811ffb8a6164",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 19139,
            "upload_time": "2024-08-20T19:42:44",
            "upload_time_iso_8601": "2024-08-20T19:42:44.241978Z",
            "url": "https://files.pythonhosted.org/packages/df/0d/c37b5e4369cca225b7a957f6b15cd4e66201a800c2a36c290e796e90a153/python_kv-0.2.14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-20 19:42:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "marciclabas",
    "github_project": "kv",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "python-kv"
}
        
Elapsed time: 0.65541s