{"id":48611090,"url":"https://github.com/litements/litedict","last_synced_at":"2026-04-09T00:34:29.422Z","repository":{"id":39536307,"uuid":"336794559","full_name":"litements/litedict","owner":"litements","description":"SQLite as a Python dictionary","archived":false,"fork":false,"pushed_at":"2023-08-30T22:58:25.000Z","size":34,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-06T08:57:06.303Z","etag":null,"topics":["dictionary","python","sql","sqlite"],"latest_commit_sha":null,"homepage":"https://litements.polyrand.net/dictionary/","language":"Jupyter Notebook","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/litements.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}},"created_at":"2021-02-07T13:33:33.000Z","updated_at":"2025-10-17T16:14:42.000Z","dependencies_parsed_at":"2022-09-20T04:41:41.002Z","dependency_job_id":null,"html_url":"https://github.com/litements/litedict","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/litements/litedict","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litements%2Flitedict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litements%2Flitedict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litements%2Flitedict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litements%2Flitedict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litements","download_url":"https://codeload.github.com/litements/litedict/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litements%2Flitedict/sbom","scorecard":{"id":592712,"data":{"date":"2025-08-11","repo":{"name":"github.com/litements/litedict","commit":"377603fa597453ffd9997186a493ed4fd23e5399"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/22 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/pypi-publish.yaml:1","Warn: no topLevel permission defined: .github/workflows/tests.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pypi-publish.yaml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/litements/litedict/pypi-publish.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pypi-publish.yaml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/litements/litedict/pypi-publish.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pypi-publish.yaml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/litements/litedict/pypi-publish.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/litements/litedict/tests.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/litements/litedict/tests.yaml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/pypi-publish.yaml:15","Warn: pipCommand not pinned by hash: .github/workflows/tests.yaml:18","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T22:22:48.189Z","repository_id":39536307,"created_at":"2025-08-20T22:22:48.189Z","updated_at":"2025-08-20T22:22:48.189Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31580182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dictionary","python","sql","sqlite"],"created_at":"2026-04-09T00:34:29.252Z","updated_at":"2026-04-09T00:34:29.406Z","avatar_url":"https://github.com/litements.png","language":"Jupyter Notebook","readme":"# litedict\n\n\u003e Dictionary implemented on top of SQLite\n\n## Why?\n\nYou can use this to implement a persistent dictionary. It also uses some SQLite syntax to enable getting keys using pattern matching (see examples).\n\n## Installation\n\n```\npip install litedict\n```\n\n## Alternatives\n\n* [RaRe-Technologies/sqlitedict](https://github.com/RaRe-Technologies/sqlitedict): This library uses a separate writing thread. Modern versions of SQLite are thread safe by default (serialized), so a separate writing thread is not strictly needed. It can be helpful to avoid DB locks, but it also adds extra complexity. That implementation is also missing some performance optimizations that are present in this repository.\n\n## Examples\n\nThe examples are taken from the tests in [`tests.ipynb`](./tests.ipynb)\n\n\n```python\nfrom litedict import SQLDict\n\nTEST_1 = \"key_test_1\"\nTEST_2 = \"key_test_2\"\n```\n\nBasic functionality\n\n\n```python\nd = SQLDict(\":memory:\")\n\nd[TEST_1] = \"asdfoobar\"\n\nassert d[TEST_1] == \"asdfoobar\"\n\ndel d[TEST_1]\n\nassert d.get(TEST_1, None) is None\n\n# execute multiple instructions inside a transaction\nwith d.transaction():\n    d[\"asd\"] = \"efg\"\n    d[\"foo\"] = \"bar\"\n```\n\nGlob matching\n\n\n```python\nd[TEST_1] = \"asdfoobar\"\n\nd[TEST_2] = \"foobarasd\"\n\nd[\"key_testx_3\"] = \"barasdfoo\"\n\nassert d.glob(\"key_test*\") == [\"asdfoobar\", \"foobarasd\", \"barasdfoo\"]\n\nassert d.glob(\"key_test_?\") == [\"asdfoobar\", \"foobarasd\"]\n\nassert d.glob(\"key_tes[tx]*\") == [\"asdfoobar\", \"foobarasd\", \"barasdfoo\"]\n```\n\nNumbers\n\n\n```python\nd[TEST_1] = 1\n\nd[TEST_2] = 2\n\nassert d[TEST_1] + d[TEST_2] == 3\n```\n\n## Benchmarks\n\n\n```python\nfrom string import ascii_lowercase, printable\nfrom random import choice\nimport random\n\n\ndef random_string(string_length=10, fuzz=False, space=False):\n    \"\"\"Generate a random string of fixed length \"\"\"\n    letters = ascii_lowercase\n    letters = letters + \" \" if space else letters\n    if fuzz:\n        letters = printable\n    return \"\".join(choice(letters) for i in range(string_length))\n```\n\n\n```python\nimport gc\n\nimport pickle\n\nimport json\n```\n\n**Pickle**\n\n\n```python\nd = SQLDict(\n    \":memory:\",\n    encoder=lambda x: pickle.dumps(x).hex(),\n    decoder=lambda x: pickle.loads(bytes.fromhex(x)),\n)\n\ngc.collect()\n\n# %%timeit -n20000 -r10\n\nd[random_string(8)] = random_string(50)\n\nd.get(random_string(8), None)\n\n# 69.2 µs ± 4.84 µs per loop (mean ± std. dev. of 10 runs, 20000 loops each)\n```\n\n**Noop**\n\n```python\nd = SQLDict(\n    \":memory:\",\n    encoder=lambda x: x,\n    decoder=lambda x: x,\n)\n\ngc.collect()\n\n# %%timeit -n20000 -r10\n\nd[random_string(8)] = random_string(50)\n\nd.get(random_string(8), None)\n\n# 66.8 µs ± 2.41 µs per loop (mean ± std. dev. of 10 runs, 20000 loops each)\n```\n\n**JSON**\n\n```python\nd = SQLDict(\n    \":memory:\",\n    encoder=lambda x: json.dumps(x),\n    decoder=lambda x: json.loads(x),\n)\n\ngc.collect()\n\n# %%timeit -n20000 -r10\n\nd[random_string(8)] = random_string(50)\n\nd.get(random_string(8), None)\n\n# 68.6 µs ± 3.07 µs per loop (mean ± std. dev. of 10 runs, 20000 loops each)\n```\n\n**Pickle Python obj**\n\n\n```python\nd = SQLDict(\n    \":memory:\",\n    encoder=lambda x: pickle.dumps(x).hex(),\n    decoder=lambda x: pickle.loads(bytes.fromhex(x)),\n)\n\ngc.collect()\n\nclass C:\n    def __init__(self, x):\n        self.x = x\n\n    def pp(self):\n        return x\n\n    def f(self):\n        def _f(y):\n            return y * self.x ** 2\n\n        return _f\n\n# %%timeit -n20000 -r10\n\nd[random_string(8)] = C(random.randint(1, 200))\n\nd.get(random_string(8), None)\n\n# 41.1 µs ± 2.75 µs per loop (mean ± std. dev. of 10 runs, 20000 loops each)\n```\n\n\n**Dictionary**\n\n\n```python\nd = {}\n\ngc.collect()\n\n# %%timeit -n20000 -r10\n\nd[random_string(8)] = random_string(50)\n\nd.get(random_string(8), None)\n\n# 53.1 µs ± 4.42 µs per loop (mean ± std. dev. of 10 runs, 20000 loops each)\n```\n\n## Changelog\n\n* 0.3\n\t* Add transactions as part of the dictionary \n\n\n## Meta\n\n\nRicardo Ander-Egg Aguilar – [@ricardoanderegg](https://twitter.com/ricardoanderegg) –\n\n- [ricardoanderegg.com](http://ricardoanderegg.com/)\n- [github.com/polyrand](https://github.com/polyrand/)\n- [linkedin.com/in/ricardoanderegg](http://linkedin.com/in/ricardoanderegg)\n\nDistributed under the MIT license. See ``LICENSE`` for more information.\n\n## Contributing\n\nThe only hard rules for the project are:\n\n* No extra dependencies allowed\n* No extra files, everything must be inside the main module's `.py` file.\n* Tests must be inside the `tests.ipynb` notebook.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitements%2Flitedict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitements%2Flitedict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitements%2Flitedict/lists"}