{"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pycrdt-store"],"cli":null},"imports":["from pycrdt_store import SQLiteYStore","from pycrdt import YDoc"],"auth":{"required":false,"env_vars":[]},"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`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}