[![Github Actions Status][github-status-image]][github-status-url] 
QYStore is a custom implementation of a YStore for JupyterLab Collaboration, based on SQLiteYStore but with enhanced capabilities such as:
- ✅ In-memory (RAM) database support (
:memory:) - ⏳ Document Time-To-Live (TTL)
 - 🧠 Automatic checkpointing at regular intervals
 - 🗜️ Data compression before saving and decompression after loading
 - ⚙️ Configurable via standard Jupyter configuration system
 
By default, when you install this package, the following configuration is automatically set:
{
  "YDocExtension": {
    "ystore_class": "q_store.QYStore"
  },
  "QYStore": {
    "db_path": ":memory:",
    "document_ttl": 10800,
    "checkpoint_interval": 400
  }
}This means:
- The custom 
QYStoreclass is used as the YStore backend. - An in-memory SQLite database is used (
db_path: ":memory:"), so data is not persisted across server restarts. - Documents are deleted from memory after 3 hours (10,800 seconds) of inactivity.
 - A checkpoint is created every 400 updates.
 
If you need to customize these settings, you can override them in your Jupyter configuration files (e.g., ~/.jupyter/jupyter_server_config.py or jupyter_server_config.json).
For example, to change the TTL or use a persistent database file, update your config as follows:
# Use a persistent SQLite file
c.QYStore.db_path = "qstore.db"
# Set a custom TTL (in seconds)
c.QYStore.document_ttl = 600  # 10 minutes
# Set a custom checkpoint interval
c.QYStore.checkpoint_interval = 100Refer to the Jupyter documentation for more details on configuring server extensions.
| Feature | Description | 
|---|---|
document_ttl | 
Automatically clears documents from memory after a specified time of inactivity | 
checkpoint_interval | 
Automatically saves a checkpoint every N updates to prevent data loss | 
db_path | 
Choose between a persistent SQLite file or in-memory database (:memory:) | 
| Compression | Document updates are compressed before storing and decompressed when loading | 
This extension is composed of a Python package named q_store
for the server extension and a NPM package named qStore
for the frontend extension.
- JupyterLab >= 4.0.0
 
To install the extension, execute:
pip install q_storeTo remove the extension, execute:
pip uninstall q_storeIf you are seeing the frontend extension, but it is not working, check that the server extension is enabled:
jupyter server extension listIf the server extension is installed and enabled, but you are not seeing the frontend extension, check the frontend extension is installed:
jupyter labextension listNote: You will need NodeJS to build the extension package.
The jlpm command is JupyterLab's pinned version of
yarn that is installed with JupyterLab. You may use
yarn or npm in lieu of jlpm below.
# Clone the repo to your local environment
# Change directory to the q_store directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Server extension must be manually installed in develop mode
jupyter server extension enable q_store
# Rebuild extension Typescript source after making changes
jlpm buildYou can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter labWith the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
By default, the jlpm build command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
jupyter lab build --minimize=False# Server extension must be manually disabled in develop mode
jupyter server extension disable q_store
pip uninstall q_storeIn development mode, you will also need to remove the symlink created by jupyter labextension develop
command. To find its location, you can run jupyter labextension list to figure out where the labextensions
folder is located. Then you can remove the symlink named qStore within that folder.
See RELEASE