{"id":28289483,"url":"https://github.com/louisyoungx/stora","last_synced_at":"2025-06-13T04:30:51.654Z","repository":{"id":45365826,"uuid":"434961068","full_name":"louisyoungx/stora","owner":"louisyoungx","description":"A simple, reactive local storage library.","archived":false,"fork":false,"pushed_at":"2021-12-27T17:49:12.000Z","size":14,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-22T01:12:56.876Z","etag":null,"topics":["json","library","python","reactive","stora","storage"],"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/louisyoungx.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-04T17:07:59.000Z","updated_at":"2022-12-24T14:49:29.000Z","dependencies_parsed_at":"2022-09-13T15:31:13.470Z","dependency_job_id":null,"html_url":"https://github.com/louisyoungx/stora","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/louisyoungx/stora","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisyoungx%2Fstora","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisyoungx%2Fstora/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisyoungx%2Fstora/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisyoungx%2Fstora/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/louisyoungx","download_url":"https://codeload.github.com/louisyoungx/stora/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/louisyoungx%2Fstora/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259580551,"owners_count":22879679,"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":["json","library","python","reactive","stora","storage"],"created_at":"2025-05-22T01:12:19.463Z","updated_at":"2025-06-13T04:30:51.645Z","avatar_url":"https://github.com/louisyoungx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Stora  [![Visits][visits-badge]](github-page) [![Version][version-badge]][version-link] [![MIT License][license-badge]](LICENSE.md)\n\n**Stora** is a simple, reactive local storage library.\n\n```python\n\u003e\u003e\u003e from stora import stora\n\u003e\u003e\u003e apple = {\"name\": \"Apple\", \"price\": \"10\", \"size\": \"small\"}\n\u003e\u003e\u003e s = stora(apple)\n\u003e\u003e\u003e s.state\n'{\"name\": \"Apple\", \"price\": \"10\", \"size\": \"small\"}'\n\u003e\u003e\u003e s.file\n'/home/user/project/state.json'\n\u003e\u003e\u003e s.state[\"size\"] = \"middle\"\n\u003e\u003e\u003e s.state\n'{\"name\": \"Apple\", \"price\": \"10\", \"size\": \"middle\"}'\n```\n\nStora allows you to save dict to local as json extremely easily. There’s no need to manually open file and read, or save file after change your dict data — but nowadays,  just editor the state, and Stora will automatically save for you!\n\nStora is a new Python package, welcome issue and pull request.\n\n## Installing Stora and Supported Versions\n\nStora is available on PyPI:\n\n```shell\n$ python3 -m pip install stora\n```\n\nStora only support Python 3.6+.\n\n## Supported Features \u0026 Best–Practices\n\nStora is ready for simple data storage.\n\n\u003e if you need high performance, use a professional database is a better choice.\n\n- Data persistence saving.\n- Synchronize data saving to local.\n- Customizable file names.\n- Customize the save directory.\n- Save format is *json* by default.\n- Read format is *dict* by default.\n- TODO Save files asynchronously\n- TODO Debounce function\n\n## Quick Start\n\nStora will save data as `state.json` in **current working directory**.\n\n```python\nfrom stora import stora\napple = {\"name\": \"Apple\", \"price\": \"10\", \"size\": \"small\"}\ns = stora(apple)\nprint(s.state) # {\"name\": \"Apple\", \"price\": \"10\", \"size\": \"small\"}\n```\n\n\u003e **PS:** *You can also decide the filename and filepath.*\n\u003e ```python\n\u003e s = stora(apple, filename='apple.json', filepath='~/.data/')\n\u003e ```\n\nNow open `state.json`, you will see:\n```json\n{\n    \"name\": \"Apple\",\n    \"price\": \"10\",\n    \"size\": \"small\"\n}\n```\n\nNext time when you initialize a stora class in the same working directory, Stora will search if there is a file called `state.json`, if it exists it will load it and return a reactive dict.\n\n```python\nfrom stora import stora\ns = stora()    # Stora will search state.json and load it\nprint(s.state) # {\"name\": \"Apple\", \"price\": \"10\", \"size\": \"small\"}\n```\n\n\u003e **PS:** If the filename and filepath are specified, use the following code to initialize it.\n\u003e\n\u003e ```python\n\u003e s = stora(filename='apple.json', filepath='~/.data/')\n\u003e ```\n\nFetching and assignment operations are exactly the same as dict.\n\n```python\n# Fetching\nprint(s.state['name']) # Apple\nprint(s.state['price']) # 10\n# Assignment\ns.state['name'] = 'Banana'\ns.state['price'] = 20\n```\n\nNow you will see that the contents of the `state.json` have changed.\n\n```json\n{\n    \"name\": \"Banana\",\n    \"price\": \"20\",\n    \"size\": \"small\"\n}\n```\n\nHere's a feature that may cause confusion. If initialize stora again,\n\n```python\nfrom stora import stora\napple = {\"name\": \"Apple\", \"price\": \"10\", \"size\": \"small\"}\ns = stora(apple)\nprint(s.state) # {\"name\": \"Banana\", \"price\": \"20\", \"size\": \"small\"}\n```\n\nrun `print(s.state)`, you will find the data is not what you assign to stora, it's data saved in `state.json` .\n\nThat's because stora sets the data already read under the current filepath and filename to a higher priority in order to prevent data loss.\n\nYou can force an overwrite of the stora state, or define a new stora with different filename or filepath.\n\n```python\ns1 = stora(apple, force=True) # force an overwrite\ns2 = stora(apple, filename='apple-10.json') # define a new stora with different filename or filepath\n```\n\n## API Reference and User Guide available on [Read the Docs](#)\n\nComing soon.\n\n## Cloning the repository\n\n```shell\ngit clone https://github.com/louisyoungx/stora.git\n```\n\n\n\n[github-page]: https://github.com/louisyoungx/stora\n[version-badge]:   https://img.shields.io/pypi/v/stora.svg?label=version\n[version-link]:    https://pypi.python.org/pypi/stora/\n[license-badge]:   https://img.shields.io/badge/license-MIT-007EC7.svg\n[visits-badge]: https://badges.pufler.dev/visits/louisyoungx/stora\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisyoungx%2Fstora","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouisyoungx%2Fstora","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisyoungx%2Fstora/lists"}