{"id":10085,"library":"pycrdt-store","title":"PyCRDT Store","description":"pycrdt-store provides persistent storage solutions for `pycrdt`, specifically offering a `SQLiteYStore` implementation. It enables `pycrdt` documents to persist their state beyond application lifetime, supporting features like history squashing, cleanup based on database size, and performance optimizations. The current version is 0.1.3, and the library is under active development with frequent minor releases addressing performance, features, and bug fixes.","status":"active","version":"0.1.3","language":"python","source_language":"en","source_url":"https://github.com/y-crdt/pycrdt-store","tags":["CRDT","Y-CRDT","Database","SQLite","Realtime","Persistence","Offline-first"],"install":[{"cmd":"pip install pycrdt-store","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Core dependency for CRDT document management, as pycrdt-store provides its persistence layer.","package":"pycrdt"}],"imports":[{"wrong":"from pycrdt import SQLiteYStore","symbol":"SQLiteYStore","correct":"from pycrdt import SQLiteYStore"}],"quickstart":{"code":"import asyncio\nfrom pycrdt import YDoc\nfrom pycrdt_store import SQLiteYStore\n\nasync def main():\n    # Use an in-memory database for quick testing, or provide a file path\n    # e.g., SQLiteYStore(path=\"./my_document.db\")\n    store = SQLiteYStore(path=\":memory:\")\n    await store.setup() # Initialize the store connection\n\n    doc_name = \"my_persistent_doc\"\n    ydoc = YDoc(doc_name, store) # Associate YDoc with the store\n\n    # Perform CRDT operations\n    text = ydoc.get_text(\"my_text\")\n    text.insert(0, \"Hello, world!\")\n\n    # Changes are automatically synchronized with the store by YDoc\n\n    print(f\"Document content: {text.to_py()}\")\n\n    await store.close() # Close the store connection\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates how to set up `SQLiteYStore` with a `pycrdt.YDoc` to enable persistent storage. It initializes an in-memory SQLite database, performs a simple text insertion, and then properly closes the store. For file-based persistence, replace `:memory:` with a file path like `./my_document.db`."},"warnings":[{"fix":"Review the `SQLiteYStore` constructor arguments for `cleanup_when_db_size_above`, `squash_history_older_than`, and `squash_no_more_often_than` to configure the automatic maintenance behavior.","message":"Version 0.1.3 introduced automatic database cleanup and history squashing features (`cleanup_when_db_size_above`, `squash_history_older_than`). While these improve performance and manageability, they are active by default or through configuration. Users upgrading may want to review and explicitly configure these options to match their desired data retention and database size policies.","severity":"gotcha","affected_versions":">=0.1.3"},{"fix":"Always ensure `await store.setup()` is called before using the store, and `await store.close()` is called when the store is no longer needed, typically at application shutdown.","message":"Asynchronous setup and teardown of `SQLiteYStore` are crucial. Forgetting to `await store.setup()` or `await store.close()` can lead to uninitialized stores, resource leaks, or unsaved data, especially in file-based persistence scenarios.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that every `YDoc` instance using the same `SQLiteYStore` has a distinct `doc_name` string passed during its initialization: `YDoc(unique_doc_name, store)`.","message":"While `SQLiteYStore` can manage multiple `YDoc` instances, each `YDoc` must have a unique `doc_name` when associated with the same store. Reusing a `doc_name` for different `YDoc` objects can lead to data corruption or unexpected behavior.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.1.3':45 'activ':51 'address':57 'applic':26 'base':34 'beyond':25 'bug':61 'cleanup':33 'crdt':63,66 'current':42 'databas':36,67 'develop':52 'document':20 'enabl':18 'featur':29,59 'first':73 'fix':62 'frequent':54 'histori':31 'implement':16 'librari':48 'lifetim':27 'like':30 'minor':55 'offer':13 'offlin':72 'offline-first':71 'optim':40 'perform':39,58 'persist':7,22,70 'provid':6 'pycrdt':1,4,11,19 'pycrdt-stor':3 'realtim':69 'releas':56 'size':37 'solut':9 'specif':12 'sqlite':68 'sqliteystor':15 'squash':32 'state':24 'storag':8 'store':2,5 'support':28 'version':43 'y':65 'y-crdt':64","created_at":"2026-04-17T01:22:17.998817+00:00","updated_at":"2026-04-17T01:22:17.998817+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'SQLiteYStore' from 'pycrdt' (/tmp/tmp1jdy1v6k/venv/lib/python3.12/site-packages/pycrdt/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1.5","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/y-crdt/pycrdt-store","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pycrdt-store/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}