scruby


Namescruby JSON
Version 0.6.3 PyPI version JSON
download
home_pageNone
SummaryA fast key-value storage library.
upload_time2025-09-20 06:20:42
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.12
licenseNone
keywords database db scruby store
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <p align="center">
    <a href="https://github.com/kebasyaty/scruby">
      <img
        height="80"
        alt="Logo"
        src="https://raw.githubusercontent.com/kebasyaty/scruby/main/assets/logo.svg">
    </a>
  </p>
  <p>
    <h1>Scruby</h1>
    <h3>A fast key-value storage library.</h3>
    <p align="center">
      <a href="https://github.com/kebasyaty/scruby/actions/workflows/test.yml" alt="Build Status"><img src="https://github.com/kebasyaty/scruby/actions/workflows/test.yml/badge.svg" alt="Build Status"></a>
      <a href="https://kebasyaty.github.io/scruby/" alt="Docs"><img src="https://img.shields.io/badge/docs-available-brightgreen.svg" alt="Docs"></a>
      <a href="https://pypi.python.org/pypi/scruby/" alt="PyPI pyversions"><img src="https://img.shields.io/pypi/pyversions/scruby.svg" alt="PyPI pyversions"></a>
      <a href="https://pypi.python.org/pypi/scruby/" alt="PyPI status"><img src="https://img.shields.io/pypi/status/scruby.svg" alt="PyPI status"></a>
      <a href="https://pypi.python.org/pypi/scruby/" alt="PyPI version fury.io"><img src="https://badge.fury.io/py/scruby.svg" alt="PyPI version fury.io"></a>
      <br>
      <a href="https://github.com/kebasyaty/scruby/issues"><img src="https://img.shields.io/github/issues/kebasyaty/scruby.svg" alt="GitHub issues"></a>
      <a href="https://pepy.tech/projects/scruby"><img src="https://static.pepy.tech/badge/scruby" alt="PyPI Downloads"></a>
      <a href="https://github.com/kebasyaty/scruby/blob/main/LICENSE" alt="GitHub license"><img src="https://img.shields.io/github/license/kebasyaty/scruby" alt="GitHub license"></a>
      <a href="https://mypy-lang.org/" alt="Types: Mypy"><img src="https://img.shields.io/badge/types-Mypy-202235.svg?color=0c7ebf" alt="Types: Mypy"></a>
      <a href="https://docs.astral.sh/ruff/" alt="Code style: Ruff"><img src="https://img.shields.io/badge/code%20style-Ruff-FDD835.svg" alt="Code style: Ruff"></a>
      <a href="https://github.com/kebasyaty/scruby" alt="PyPI implementation"><img src="https://img.shields.io/pypi/implementation/scruby" alt="PyPI implementation"></a>
      <br>
      <a href="https://pypi.org/project/scruby"><img src="https://img.shields.io/pypi/format/scruby" alt="Format"></a>
      <a href="https://github.com/kebasyaty/scruby"><img src="https://img.shields.io/github/languages/top/kebasyaty/scruby" alt="Top"></a>
      <a href="https://github.com/kebasyaty/scruby"><img src="https://img.shields.io/github/repo-size/kebasyaty/scruby" alt="Size"></a>
      <a href="https://github.com/kebasyaty/scruby"><img src="https://img.shields.io/github/last-commit/kebasyaty/scruby/main" alt="Last commit"></a>
      <a href="https://github.com/kebasyaty/scruby/releases/" alt="GitHub release"><img src="https://img.shields.io/github/release/kebasyaty/scruby" alt="GitHub release"></a>
    </p>
    <p align="center">
      Scruby is a fast key-value storage asynchronous library that provides an
      <br>
      ordered mapping from string keys to string values.
      <br>
      The library uses fractal-tree addressing.
      <br>
      The database consists of collections.
      <br>
      The maximum size of the one collection is 16**8=4294967296 branches,
      each branch can store one or more keys.
      <br>
      The value of any key in collection can be obtained in 8 steps, thereby achieving high performance.
      <br>
      In the future, to search by value of key, the use of a quantum loop is supposed.
    </p>
  </p>
</div>

##

<br>

## Documentation

Online browsable documentation is available at [https://kebasyaty.github.io/scruby/](https://kebasyaty.github.io/scruby/ "Documentation").

## Requirements

[View the list of requirements](https://github.com/kebasyaty/scruby/blob/v0/REQUIREMENTS.md "Requirements").

## Installation

```shell
uv add scruby
```

## Usage

```python
import anyio
import datetime
from pydantic import BaseModel, EmailStr
from pydantic_extra_types.phone_numbers import PhoneNumber
from scruby import Scruby, constants

constants.DB_ROOT = "ScrubyDB"  # By default = "ScrubyDB"

class User(BaseModel):
    """Model of User."""
    first_name: str
    last_name: str
    birthday: datetime.datetime
    email: EmailStr
    phone: PhoneNumber

async def main() -> None:
    """Example."""
    # Get collection of `User`.
    user_coll = Scruby(User)

    user = User(
        first_name="John",
        last_name="Smith",
        birthday=datetime.datetime(1970, 1, 1),
        email="John_Smith@gmail.com",
        phone="+447986123456",
    )

    await user_coll.set_key("+447986123456", user)

    await user_coll.get_key("+447986123456")  # => user
    await user_coll.get_key("key missing")  # => KeyError

    await user_coll.has_key("+447986123456")  # => True
    await user_coll.has_key("key missing")  # => False

    await user_coll.delete_key("+447986123456")
    await user_coll.delete_key("+447986123456")  # => KeyError
    await user_coll.delete_key("key missing")  # => KeyError

    # Full database deletion.
    # Hint: The main purpose is tests.
    await Scruby.napalm()

if __name__ == "__main__":
    anyio.run(main)
```

## Changelog

[View the change history](https://github.com/kebasyaty/scruby/blob/v0/CHANGELOG.md "Changelog").

## License

This project is licensed under the [MIT](https://github.com/kebasyaty/scruby/blob/main/LICENSE "MIT").

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "scruby",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": "database, db, scruby, store",
    "author": null,
    "author_email": "kebasyaty <kebasyaty@gmail.com>",
    "download_url": null,
    "platform": null,
    "description": "<div align=\"center\">\n  <p align=\"center\">\n    <a href=\"https://github.com/kebasyaty/scruby\">\n      <img\n        height=\"80\"\n        alt=\"Logo\"\n        src=\"https://raw.githubusercontent.com/kebasyaty/scruby/main/assets/logo.svg\">\n    </a>\n  </p>\n  <p>\n    <h1>Scruby</h1>\n    <h3>A fast key-value storage library.</h3>\n    <p align=\"center\">\n      <a href=\"https://github.com/kebasyaty/scruby/actions/workflows/test.yml\" alt=\"Build Status\"><img src=\"https://github.com/kebasyaty/scruby/actions/workflows/test.yml/badge.svg\" alt=\"Build Status\"></a>\n      <a href=\"https://kebasyaty.github.io/scruby/\" alt=\"Docs\"><img src=\"https://img.shields.io/badge/docs-available-brightgreen.svg\" alt=\"Docs\"></a>\n      <a href=\"https://pypi.python.org/pypi/scruby/\" alt=\"PyPI pyversions\"><img src=\"https://img.shields.io/pypi/pyversions/scruby.svg\" alt=\"PyPI pyversions\"></a>\n      <a href=\"https://pypi.python.org/pypi/scruby/\" alt=\"PyPI status\"><img src=\"https://img.shields.io/pypi/status/scruby.svg\" alt=\"PyPI status\"></a>\n      <a href=\"https://pypi.python.org/pypi/scruby/\" alt=\"PyPI version fury.io\"><img src=\"https://badge.fury.io/py/scruby.svg\" alt=\"PyPI version fury.io\"></a>\n      <br>\n      <a href=\"https://github.com/kebasyaty/scruby/issues\"><img src=\"https://img.shields.io/github/issues/kebasyaty/scruby.svg\" alt=\"GitHub issues\"></a>\n      <a href=\"https://pepy.tech/projects/scruby\"><img src=\"https://static.pepy.tech/badge/scruby\" alt=\"PyPI Downloads\"></a>\n      <a href=\"https://github.com/kebasyaty/scruby/blob/main/LICENSE\" alt=\"GitHub license\"><img src=\"https://img.shields.io/github/license/kebasyaty/scruby\" alt=\"GitHub license\"></a>\n      <a href=\"https://mypy-lang.org/\" alt=\"Types: Mypy\"><img src=\"https://img.shields.io/badge/types-Mypy-202235.svg?color=0c7ebf\" alt=\"Types: Mypy\"></a>\n      <a href=\"https://docs.astral.sh/ruff/\" alt=\"Code style: Ruff\"><img src=\"https://img.shields.io/badge/code%20style-Ruff-FDD835.svg\" alt=\"Code style: Ruff\"></a>\n      <a href=\"https://github.com/kebasyaty/scruby\" alt=\"PyPI implementation\"><img src=\"https://img.shields.io/pypi/implementation/scruby\" alt=\"PyPI implementation\"></a>\n      <br>\n      <a href=\"https://pypi.org/project/scruby\"><img src=\"https://img.shields.io/pypi/format/scruby\" alt=\"Format\"></a>\n      <a href=\"https://github.com/kebasyaty/scruby\"><img src=\"https://img.shields.io/github/languages/top/kebasyaty/scruby\" alt=\"Top\"></a>\n      <a href=\"https://github.com/kebasyaty/scruby\"><img src=\"https://img.shields.io/github/repo-size/kebasyaty/scruby\" alt=\"Size\"></a>\n      <a href=\"https://github.com/kebasyaty/scruby\"><img src=\"https://img.shields.io/github/last-commit/kebasyaty/scruby/main\" alt=\"Last commit\"></a>\n      <a href=\"https://github.com/kebasyaty/scruby/releases/\" alt=\"GitHub release\"><img src=\"https://img.shields.io/github/release/kebasyaty/scruby\" alt=\"GitHub release\"></a>\n    </p>\n    <p align=\"center\">\n      Scruby is a fast key-value storage asynchronous library that provides an\n      <br>\n      ordered mapping from string keys to string values.\n      <br>\n      The library uses fractal-tree addressing.\n      <br>\n      The database consists of collections.\n      <br>\n      The maximum size of the one collection is 16**8=4294967296 branches,\n      each branch can store one or more keys.\n      <br>\n      The value of any key in collection can be obtained in 8 steps, thereby achieving high performance.\n      <br>\n      In the future, to search by value of key, the use of a quantum loop is supposed.\n    </p>\n  </p>\n</div>\n\n##\n\n<br>\n\n## Documentation\n\nOnline browsable documentation is available at [https://kebasyaty.github.io/scruby/](https://kebasyaty.github.io/scruby/ \"Documentation\").\n\n## Requirements\n\n[View the list of requirements](https://github.com/kebasyaty/scruby/blob/v0/REQUIREMENTS.md \"Requirements\").\n\n## Installation\n\n```shell\nuv add scruby\n```\n\n## Usage\n\n```python\nimport anyio\nimport datetime\nfrom pydantic import BaseModel, EmailStr\nfrom pydantic_extra_types.phone_numbers import PhoneNumber\nfrom scruby import Scruby, constants\n\nconstants.DB_ROOT = \"ScrubyDB\"  # By default = \"ScrubyDB\"\n\nclass User(BaseModel):\n    \"\"\"Model of User.\"\"\"\n    first_name: str\n    last_name: str\n    birthday: datetime.datetime\n    email: EmailStr\n    phone: PhoneNumber\n\nasync def main() -> None:\n    \"\"\"Example.\"\"\"\n    # Get collection of `User`.\n    user_coll = Scruby(User)\n\n    user = User(\n        first_name=\"John\",\n        last_name=\"Smith\",\n        birthday=datetime.datetime(1970, 1, 1),\n        email=\"John_Smith@gmail.com\",\n        phone=\"+447986123456\",\n    )\n\n    await user_coll.set_key(\"+447986123456\", user)\n\n    await user_coll.get_key(\"+447986123456\")  # => user\n    await user_coll.get_key(\"key missing\")  # => KeyError\n\n    await user_coll.has_key(\"+447986123456\")  # => True\n    await user_coll.has_key(\"key missing\")  # => False\n\n    await user_coll.delete_key(\"+447986123456\")\n    await user_coll.delete_key(\"+447986123456\")  # => KeyError\n    await user_coll.delete_key(\"key missing\")  # => KeyError\n\n    # Full database deletion.\n    # Hint: The main purpose is tests.\n    await Scruby.napalm()\n\nif __name__ == \"__main__\":\n    anyio.run(main)\n```\n\n## Changelog\n\n[View the change history](https://github.com/kebasyaty/scruby/blob/v0/CHANGELOG.md \"Changelog\").\n\n## License\n\nThis project is licensed under the [MIT](https://github.com/kebasyaty/scruby/blob/main/LICENSE \"MIT\").\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A fast key-value storage library.",
    "version": "0.6.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/kebasyaty/scruby/issues",
        "Changelog": "https://github.com/kebasyaty/scruby/blob/v0/CHANGELOG.md",
        "Homepage": "https://github.com/kebasyaty/scruby",
        "Repository": "https://github.com/kebasyaty/scruby",
        "Source": "https://github.com/kebasyaty/scruby"
    },
    "split_keywords": [
        "database",
        " db",
        " scruby",
        " store"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7ccc24d9e6bd01ea789363a246446011b1ede4236e292efca18a63403a4461a0",
                "md5": "5bdf8ac7b2fc87b00a0bdc26b76953a4",
                "sha256": "ea8e2e1604f489ef2eb49fd59b0c051a6f65726d920a1b9aaf6e970319070a62"
            },
            "downloads": -1,
            "filename": "scruby-0.6.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5bdf8ac7b2fc87b00a0bdc26b76953a4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.12",
            "size": 6361,
            "upload_time": "2025-09-20T06:20:42",
            "upload_time_iso_8601": "2025-09-20T06:20:42.996376Z",
            "url": "https://files.pythonhosted.org/packages/7c/cc/24d9e6bd01ea789363a246446011b1ede4236e292efca18a63403a4461a0/scruby-0.6.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-20 06:20:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kebasyaty",
    "github_project": "scruby",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "scruby"
}
        
Elapsed time: 0.54124s