ya_pickledb


Nameya_pickledb JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryYet another PickleDB (thread-safe!)
upload_time2024-01-17 16:28:45
maintainer
docs_urlNone
authorAngelo Delicato
requires_python>=3.9,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">
	<img src="https://github.com/thelicato/ya-pickledb/blob/main/logo.png?raw=true" width="400">
</h1>

<h4 align="center">Yet another PickleDB (thread-safe!)</h4>

<p align="center">
  <a href="#-features">Features</a> •
  <a href="#-usage">Usage</a> •
  <a href="#-installation">Installation</a> •
  <a href="#-license">License</a> •
</p>

---

``ya-pickledb`` (Yet Another PickleDB) is a an open-source key-value store for *Python* using the ``json`` module. It is heavily inspired by [pickledb](https://github.com/patx/pickledb), but also provides new features (like thread-safety using ``safer``). 

The new feature additions are inspired by [elara](https://github.com/saurabh0719/elara); but since it cannot serialize complex data structure to filesystem I decided to take the best of both worlds and create a new package.

## ⚡ Features

- Manipulate different data structures (strings, lists, dictionaries and so on)
- Fast and flexible
- Thread-safe!
- Choose between manual and auto commits
- Cache simple data structures

## 📚 Usage

```python
import ya_pickledb

db = ya_pickledb.load('kvstore.db', True)

db.set('foo', 'bar')
value = db.get('foo')

print(value)
```

This is the full list of all functions available to the user:
- ``commit()``: manually save the data to file storage.
- ``set(key, value, max_age=None)``: set the value of a key.
- ``get(key)``: get the value of a key.
- ``getall()``: get a list of all keys.
- ``exists(key)``: get wheter a key exists or not.
- ``rem(key)``: remove a key.
- ``totalkeys()``: get a total number of keys inside the db.
- ``lcreate(key)``: create a list.
- ``lpush(key, value)``: add a value to a list.
- ``lextend(key, sequence)``: extend a list with a sequence.
- ``lgetall(key)``: return all values in a list.
- ``lget(key, value, pos)``: return the value in a specific position of a list.
- ``lrange(key, start=None, end=None)``: return range of values in a list.
- ``lremlist(key)``: remove a list.
- ``lremvalue(key, value)``: remove a value from a list.
- ``lpop(key, pos)``: remove ne value in a list.
- ``llen(key)``: return the length of a list.
- ``lexists(key, value)``: determine if a value exists in a list.
- ``hcreate(key)``: create a dict.
- ``hset(key, dict_key, value)``: add a key-value pair to a dict.
- ``hget(key, dict_key)``: get the value for a key in a dict.
- ``hgetall(key)``: get all the key-value pairs from a dict.
- ``hrem(key)``: remove a dict.
- ``hpop(key, dict_key)``: remove one key-value pair fro a dict.
- ``hkeys(key)``: get all the keys for a dict.
- ``hvals(key)``: get all the values for a dict.
- ``hexists(key, dict_key)``: determine if a key exists in a dict.


## 🚀 Installation

Run the following command to install the latest version:

```
pip install ya_pickledb
```


## 🪪 License

*ya_pickledb* is made with 🖤 by the [thelicato](https://thelicato.io) and released under the [MIT LICENSE](https://github.com/thelicato/ya-pickledb/blob/main/LICENSE).
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ya_pickledb",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Angelo Delicato",
    "author_email": "thelicato@duck.com",
    "download_url": "https://files.pythonhosted.org/packages/2f/82/2ce55badbe3e106827a8c87d0429841ea424f471c03bd67b01ea7889a090/ya_pickledb-0.1.1.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\n\t<img src=\"https://github.com/thelicato/ya-pickledb/blob/main/logo.png?raw=true\" width=\"400\">\n</h1>\n\n<h4 align=\"center\">Yet another PickleDB (thread-safe!)</h4>\n\n<p align=\"center\">\n  <a href=\"#-features\">Features</a> \u2022\n  <a href=\"#-usage\">Usage</a> \u2022\n  <a href=\"#-installation\">Installation</a> \u2022\n  <a href=\"#-license\">License</a> \u2022\n</p>\n\n---\n\n``ya-pickledb`` (Yet Another PickleDB) is a an open-source key-value store for *Python* using the ``json`` module. It is heavily inspired by [pickledb](https://github.com/patx/pickledb), but also provides new features (like thread-safety using ``safer``). \n\nThe new feature additions are inspired by [elara](https://github.com/saurabh0719/elara); but since it cannot serialize complex data structure to filesystem I decided to take the best of both worlds and create a new package.\n\n## \u26a1 Features\n\n- Manipulate different data structures (strings, lists, dictionaries and so on)\n- Fast and flexible\n- Thread-safe!\n- Choose between manual and auto commits\n- Cache simple data structures\n\n## \ud83d\udcda Usage\n\n```python\nimport ya_pickledb\n\ndb = ya_pickledb.load('kvstore.db', True)\n\ndb.set('foo', 'bar')\nvalue = db.get('foo')\n\nprint(value)\n```\n\nThis is the full list of all functions available to the user:\n- ``commit()``: manually save the data to file storage.\n- ``set(key, value, max_age=None)``: set the value of a key.\n- ``get(key)``: get the value of a key.\n- ``getall()``: get a list of all keys.\n- ``exists(key)``: get wheter a key exists or not.\n- ``rem(key)``: remove a key.\n- ``totalkeys()``: get a total number of keys inside the db.\n- ``lcreate(key)``: create a list.\n- ``lpush(key, value)``: add a value to a list.\n- ``lextend(key, sequence)``: extend a list with a sequence.\n- ``lgetall(key)``: return all values in a list.\n- ``lget(key, value, pos)``: return the value in a specific position of a list.\n- ``lrange(key, start=None, end=None)``: return range of values in a list.\n- ``lremlist(key)``: remove a list.\n- ``lremvalue(key, value)``: remove a value from a list.\n- ``lpop(key, pos)``: remove ne value in a list.\n- ``llen(key)``: return the length of a list.\n- ``lexists(key, value)``: determine if a value exists in a list.\n- ``hcreate(key)``: create a dict.\n- ``hset(key, dict_key, value)``: add a key-value pair to a dict.\n- ``hget(key, dict_key)``: get the value for a key in a dict.\n- ``hgetall(key)``: get all the key-value pairs from a dict.\n- ``hrem(key)``: remove a dict.\n- ``hpop(key, dict_key)``: remove one key-value pair fro a dict.\n- ``hkeys(key)``: get all the keys for a dict.\n- ``hvals(key)``: get all the values for a dict.\n- ``hexists(key, dict_key)``: determine if a key exists in a dict.\n\n\n## \ud83d\ude80 Installation\n\nRun the following command to install the latest version:\n\n```\npip install ya_pickledb\n```\n\n\n## \ud83e\udeaa License\n\n*ya_pickledb* is made with \ud83d\udda4 by the [thelicato](https://thelicato.io) and released under the [MIT LICENSE](https://github.com/thelicato/ya-pickledb/blob/main/LICENSE).",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Yet another PickleDB (thread-safe!)",
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b0e99d2b24d97827fec5a676dd4d0b07430fc0de5e3cbb0111c0b0ad00873e0d",
                "md5": "959db49455439a8e153eea7bb8aeeca6",
                "sha256": "c7c14ace7b577adae92709074f0a6ed4bb926936ecdda24d1839a90990f0922c"
            },
            "downloads": -1,
            "filename": "ya_pickledb-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "959db49455439a8e153eea7bb8aeeca6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 6202,
            "upload_time": "2024-01-17T16:28:44",
            "upload_time_iso_8601": "2024-01-17T16:28:44.377128Z",
            "url": "https://files.pythonhosted.org/packages/b0/e9/9d2b24d97827fec5a676dd4d0b07430fc0de5e3cbb0111c0b0ad00873e0d/ya_pickledb-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f822ce55badbe3e106827a8c87d0429841ea424f471c03bd67b01ea7889a090",
                "md5": "20db29e916d3d35f1ab5cad3c910aa99",
                "sha256": "7e6186df515c7cf0e6714a07c9be75796491757f6a10403de88cfc5b61b36d16"
            },
            "downloads": -1,
            "filename": "ya_pickledb-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "20db29e916d3d35f1ab5cad3c910aa99",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 4952,
            "upload_time": "2024-01-17T16:28:45",
            "upload_time_iso_8601": "2024-01-17T16:28:45.841306Z",
            "url": "https://files.pythonhosted.org/packages/2f/82/2ce55badbe3e106827a8c87d0429841ea424f471c03bd67b01ea7889a090/ya_pickledb-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-17 16:28:45",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ya_pickledb"
}
        
Elapsed time: 0.16538s