{"id":19115355,"url":"https://github.com/perchunpak/nonbloat-db","last_synced_at":"2026-02-15T20:02:25.260Z","repository":{"id":244011861,"uuid":"814047285","full_name":"PerchunPak/nonbloat-db","owner":"PerchunPak","description":"Simple key-value database for my small projects!","archived":false,"fork":false,"pushed_at":"2024-10-09T01:10:54.000Z","size":359,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T06:06:33.911Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://nonbloat-db.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PerchunPak.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-06-12T08:38:56.000Z","updated_at":"2024-07-16T21:01:35.000Z","dependencies_parsed_at":"2024-07-16T12:59:32.539Z","dependency_job_id":null,"html_url":"https://github.com/PerchunPak/nonbloat-db","commit_stats":null,"previous_names":["perchunpak/nonbloat-db"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerchunPak%2Fnonbloat-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerchunPak%2Fnonbloat-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerchunPak%2Fnonbloat-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerchunPak%2Fnonbloat-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PerchunPak","download_url":"https://codeload.github.com/PerchunPak/nonbloat-db/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223786798,"owners_count":17202603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-09T04:46:10.178Z","updated_at":"2026-02-15T20:02:20.239Z","avatar_url":"https://github.com/PerchunPak.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nonbloat-db\n\n[![Support Ukraine](https://badgen.net/badge/support/UKRAINE/?color=0057B8\u0026labelColor=FFD700)](https://www.gov.uk/government/news/ukraine-what-you-can-do-to-help)\n\n[![Build Status](https://github.com/PerchunPak/nonbloat-db/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/PerchunPak/nonbloat-db/actions?query=workflow%3Atest)\n[![Documentation Build Status](https://readthedocs.org/projects/nonbloat-db/badge/?version=latest)](https://nonbloat-db.readthedocs.io/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Python support versions badge (from pypi)](https://img.shields.io/pypi/pyversions/nonbloat-db)](https://www.python.org/downloads/)\n\nSimple key-value database for my small projects!\n\nThe idea is to have a dead simple database, which doesn't require spinning up a\nserver (like Redis), is not underwhelming with features (like SQLite or SQL in\ngeneral), data inside can be easily manually reviewed and modified and it\ndoesn't corrupt (if you just dump JSON into file using `json.dump`, if the\nprogram was forced to stop during write (e.g. because of power outage),\nthe data will be corrupted).\n\nThe purpose of this project is to serve as a database library for my small projects.\nSo obviously this solution doesn't scale to thousands of users, and it was\nnever intended to. Use right tool for right job.\n\nAlso, do note, that everything is async. There is no synchronous version,\nbecause all of my projects are generally async. I maybe will add a synchronous\nwrapper, but I don't promise.\n\n## How does it work?\n\nIt is just a really simple key-value storage:\n\n```python\nimport asyncio\nfrom nbdb.storage import Storage\n\n\nasync def main():\n    # you need to provide a path to database\n    my_db = await Storage.init(\"data/db.json\")\n    await my_db.set(\"abc\", 123)\n\n    value = await my_db.get(\"abc\")\n    print(value)  # 123\n\n    await my_db.write()\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n\u003e [!NOTE]\n\u003e Everything in this library is asynchronous, so you have to call it\n\u003e from async functions.\n\nIn the background, a lot of things are happening. For example, when you call\n`.set`, the db writes the operation to special AOF (Append Only File; this is\nwhat [Redis uses](https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/)\nto achieve data persistence).\n\nAnd on every write, library renames `db.json` to `db.json.temp` and then writes\nto `db.json` new data. This is done to not corrupt data in case of power outage\nor force shutdown. If library during initial read finds a `.temp` file next to\ndatabase, it will output a warning and read from temp file.\n\n## Installing\n\nIt is not yet published to PyPI, so good luck.\n\n```bash\npip install nonbloat-db\n```\n\n## Installing for local developing\n\n```bash\ngit clone https://github.com/PerchunPak/nonbloat-db.git\ncd nonbloat-db\n```\n\n### Installing `poetry`\n\nNext we need install `poetry` with [recommended way](https://python-poetry.org/docs/master/#installation).\n\nIf you use Linux, use command:\n\n```bash\ncurl -sSL https://install.python-poetry.org | python -\n```\n\nIf you use Windows, open PowerShell with admin privileges and use:\n\n```powershell\n(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -\n```\n\n### Installing dependencies\n\n```bash\npoetry install\n```\n\n### If something is not clear\n\nYou can always write me!\n\n## Thanks\n\nThis project was generated with [python-template](https://github.com/PerchunPak/python-template).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperchunpak%2Fnonbloat-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperchunpak%2Fnonbloat-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperchunpak%2Fnonbloat-db/lists"}