{"id":19218917,"url":"https://github.com/bearlike/local-json-datastore","last_synced_at":"2026-06-17T22:31:28.059Z","repository":{"id":115884560,"uuid":"317561819","full_name":"bearlike/Local-JSON-Datastore","owner":"bearlike","description":"A file-based JSON data store exposed as a library.","archived":false,"fork":false,"pushed_at":"2021-09-17T11:54:11.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-13T22:06:23.278Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bearlike.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-01T14:10:44.000Z","updated_at":"2020-12-03T06:07:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"c60684e0-10ab-4c4c-89f1-a750b4115f45","html_url":"https://github.com/bearlike/Local-JSON-Datastore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bearlike/Local-JSON-Datastore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearlike%2FLocal-JSON-Datastore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearlike%2FLocal-JSON-Datastore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearlike%2FLocal-JSON-Datastore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearlike%2FLocal-JSON-Datastore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bearlike","download_url":"https://codeload.github.com/bearlike/Local-JSON-Datastore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearlike%2FLocal-JSON-Datastore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34468766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T14:28:44.149Z","updated_at":"2026-06-17T22:31:28.043Z","avatar_url":"https://github.com/bearlike.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg alt=\"Local JSON Datastore\" src=\"https://i.imgur.com/xmSiakK.png\" /\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.python.org/dev/peps/pep-0494/\"\u003e\u003cimg title=\"Python3\" src=\"https://img.shields.io/badge/Python-3-yellow\"\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.com/github/bearlike/Local-JSON-Datastore\"\u003e\u003cimg title=\"Travis CI: Build Status\" src=\"https://api.travis-ci.com/bearlike/Local-JSON-Datastore.svg?branch=main\"\u003e\u003c/a\u003e\n\u003ca href=\"LICENSE\"\u003e\u003cimg title=\"License - MIT\" src=\"https://img.shields.io/badge/License-MIT-brightgreen\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Introduction\nA file-based JSON data store exposed as a library that supports CRD operations with a lock-unlock mechanism to establish a thread-safe environment.\n\n### Features\n- A Python package for a user to import and instantiate the class to perform **CRD** operations.\n- 85% Testing Coverage for the application using **PyTest** and deployed on [**Travis CI**](https://travis-ci.com/github/bearlike/Local-JSON-Datastore).\n- **Read, Write and Delete** operations performed on a custom local data store in a user-specified location.\n- Completely **Thread-Safe** between same-user and multi-user processes. \n- A **lock-unlock mechanism** to make the data store thread-safe.\n- Supports **Time-To-Live property** through argument **`life`** in **`datastore.datastore.Datastore.create()`**, defines the seconds the key must be retained in the data store. Once `life` for a key has expired, the key will no longer be available for Reading or Delete operations.\n- **All Non-Functional Requirements satisfied**.\n- **All functions inside the package and Unit Test modules have well-defined docstring in them.** \n\n## Getting Started\n### Requirements\n\nThis package required Python 3.x.x to run. Install python from [here](https://www.python.org/).\n\n### Getting the package\n\nTo get the package, clone this repository into your local system and make it the current working directory using the following commands.\n\n```bash\ngit clone https://github.com/bearlike/Local-JSON-Datastore.git\ncd Local-JSON-Datastore\n```\n\n### Using the package\n\n####  Importing the package\n\nImport the package using the following command.\n\n```python\nimport datastore\n```\n\n#### Creating an object\n\nBy default, an object is created with the storage file called `DB.json` in the root of the present working directory as follows.\n\n```python\ndb = datastore.Datastore()\n```\n\nIn case a file path is required it can be specified while instantiating the class.\n\n```python\ndb = Datastore(path=\"test/file/path\")\n```\n\n#### Inserting an object\n\nAn object can be inserted into the data store using the `add_obj()` method which takes in a user-created dictionary as an argument and returns a `True` if an object has been successfully inserted or false otherwise.\n\n```python\ntest_object = {\n    'a':'apple',\n    'b':'ball',\n    'c':'cat',\n    'd':'dog'\n}\nis_object_inserted = db.create(key='alphabets', obj=test_object)\n```\n\n If an object has to be inserted with a specific **Time-To-Live** it can be passed as a separate argument (in seconds) to the add function. \n\n```python\ntest_object = {\n    'a':'apple',\n    'b':'ball',\n    'c':'cat',\n    'd':'dog'\n}\nis_object_inserted = db.create(key='alphabets', obj=test_object, life=100)\n```\n\n#### Deleting an Object\n\nTo delete an object that has not crossed its **Time-To-Live** the key of that object can be passed as an argument to the `delete_object()` function. Return `true` if the object has been deleted successfully else a `False`.\n\n```python\nis_object_deleted = db.delete(key='alphabets')\n```\n\n#### Retrieve an Object\n\nTo retrieve an object provide the key of the object as an argument to the `get_object()` function.\n\n```python\nkey = db.read(key='alphabet')\nprint(key)\n```\n\n```bash\n{\n    'a':'apple',\n    'b':'ball',\n    'c':'cat',\n    'd':'dog'\n}\n```\n\n\u003cp align=\"center\"\u003e\n  Made with ❤️ by \u003ca href=\"https://github.com/bearlike\"\u003eKrishna Alagiri\u003c/a\u003e\n\u003c/p\u003e\n\n![wave](http://cdn.thekrishna.in/img/common/border.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbearlike%2Flocal-json-datastore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbearlike%2Flocal-json-datastore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbearlike%2Flocal-json-datastore/lists"}