A developer-friendly, zero-dependency key-value database with TTL, file management, and in-memory search.
Project description
Quickstore
A developer-friendly, zero-dependency key-value database with TTL support, file management, in-memory search, and optional authentication. Usable as a CLI tool or importable Python package.
Table of Contents
- Features
- Installation
- Quick Start
- How It Works
- CLI Usage
- Python API Usage
- TTL Example
- Example Outputs
- Troubleshooting / FAQ
- Contributing
- Security Notes
- License
- Author
Features
- Set/get/delete/list keys with optional TTL (auto-expiry)
- Save/load to JSON file
- In-memory, case-insensitive substring search
- File management: store, retrieve, delete, search, and edit files (text, JSON, CSV)
- CLI commands and Python API
- Optional persistent user/password authentication for sensitive actions
- Advanced wipe/cleanup command
- Zero external dependencies (stdlib only)
Installation
You can install Quickstore from PyPI or for local development.
pip install quickstore
# For local development:
pip install .
Quick Start
CLI
- Set a key-value pair:
quickstore set hello world
- Retrieve the value:
quickstore get hello # Output: world
Python
from quickstore.db import Quickstore
db = Quickstore()
db.set("hello", "world")
print(db.get("hello")) # Output: world
How It Works
- Key-Value Store: Stores data as key-value pairs in a JSON file. Supports TTL (time-to-live) for auto-expiry.
- File Management: Lets you store, retrieve, delete, search, and edit files (text, JSON, CSV) with metadata tracking.
- CLI & Python API: Use all features from the command line or in your Python code.
- Authentication: Optionally protect sensitive actions (like wipe) with a username and password.
- No Dependencies: Uses only Python’s standard library.
CLI Usage
General Options
quickstore --help # Show help for all commands
quickstore <command> --help # Show help for a specific command
quickstore --version # Show the installed version
quickstore -v # Show the installed version (short flag)
Key-Value Operations
quickstore set mykey myvalue
quickstore set tempkey tempvalue --ttl 10
quickstore get mykey
quickstore list
quickstore delete mykey
quickstore search my
File Management
quickstore storefile path/to/file.txt
quickstore listfiles
quickstore getfile file.txt
quickstore deletefile file.txt
quickstore searchfiles txt
File Editing (Text, JSON, CSV only)
quickstore editfile file.txt --content "new content"
quickstore editfile file.txt --from-file path/to/newfile.txt
quickstore editfile file.txt --content "append this" --append
Security & Wipe
quickstore setpass myuser mypass # Set DB credentials
quickstore removepass # Remove credentials
quickstore wipe # Wipe all data/files (requires auth if set)
Python API Usage
Key-Value Store
from quickstore.db import Quickstore
db = Quickstore()
db.set("foo", "bar")
print(db.get("foo"))
db.set("temp", "expire", ttl=5)
print(db.list_keys())
print(db.search("foo"))
db.delete("foo")
File Management
from quickstore.filedb import FileDB
filedb = FileDB()
filedb.store_file("test_files/test.txt")
print(filedb.list_files())
print(filedb.get_file("test.txt"))
filedb.delete_file("test.txt")
filedb.search_files("test")
File Editing (Text, JSON, CSV only)
filedb.edit_file("test.txt", content="new content")
filedb.edit_file("test.txt", from_file="newfile.txt")
filedb.edit_file("test.txt", content="append this", append=True)
Security & Wipe
filedb.setpass("myuser", "mypass")
filedb.removepass()
filedb.wipe(require_auth=False) # Set to True to require auth if set
TTL (Time-to-Live) Example
from quickstore.db import Quickstore
import time
db = Quickstore()
db.set("temp", "should_expire", ttl=2)
print(db.get("temp")) # Output: should_expire
print("Waiting...")
time.sleep(3)
print(db.get("temp")) # Output: None (expired)
Example Outputs
CLI
$ quickstore set foo bar
Set foo
$ quickstore get foo
bar
$ quickstore set temp expire --ttl 2
Set temp
$ quickstore get temp
expire
$ sleep 3
$ quickstore get temp
Key not found
$ quickstore storefile test.txt
Stored file: test.txt
$ quickstore listfiles
['test.txt']
$ quickstore editfile test.txt --content "new content"
Edited file: test.txt
$ quickstore editfile test.txt --content "append this" --append
Appended to file: test.txt
$ quickstore wipe
Username: myuser
Password: mypass
Are you sure you want to wipe ALL Quickstore data and files? This cannot be undone. (yes/no): yes
Deleted quickstore.json
Deleted filemeta.json
Deleted quickstore/files directory
Database and file storage wiped.
Python
from quickstore.db import Quickstore
from quickstore.filedb import FileDB
import time
db = Quickstore()
db.set("foo", "bar")
print(db.get("foo")) # bar
filedb = FileDB()
filedb.store_file("test.txt")
print(filedb.list_files()) # ['test.txt']
filedb.edit_file("test.txt", content="new content")
filedb.edit_file("test.txt", content="append this", append=True)
filedb.delete_file("test.txt")
filedb.setpass("myuser", "mypass")
filedb.wipe(require_auth=True) # Prompts for username/password
Troubleshooting / FAQ
Q: Why is my key missing?
- The key may have expired if you set a TTL.
- Use
quickstore listordb.list_keys()to see all current keys.
Q: Can I store images or binary files?
- Yes, but you cannot edit them in-place. Use
storefileandgetfileto manage them.
Q: How do I reset everything?
- Use
quickstore wipeorfiledb.wipe()to delete all data and files.
Q: What if I forget my password?
- Delete
quickstore_auth.jsonmanually to remove authentication (local use only).
Q: Where is my data stored?
- Key-value data:
quickstore.json - File metadata:
filemeta.json - Files:
quickstore/files/
Contributing
Contributions are welcome! To contribute:
- Fork this repository
- Create a new branch for your feature or bugfix
- Make your changes and add tests
- Submit a pull request
For questions or suggestions, open an issue or email the author.
Security Notes
- Passwords are stored as SHA-256 hashes in quickstore_auth.json.
- Authentication is only required for sensitive actions (e.g., wipe) if credentials are set.
- If no credentials are set, all actions are open.
- For production-grade security, consider additional encryption or access controls.
License
MIT
Author
Avishek Devnath
avishekdevnath@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quickstore-0.1.1.tar.gz.
File metadata
- Download URL: quickstore-0.1.1.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75c900dd85834481fce94dd8c1cf5376c265912eda0db0d09e9223d7170371df
|
|
| MD5 |
474fd39df8562b6c285484455da26153
|
|
| BLAKE2b-256 |
543172d09ef4d7e34d3a0d39f2ca79f03626725d97e9c883e7edcd694d2fbf90
|
File details
Details for the file quickstore-0.1.1-py3-none-any.whl.
File metadata
- Download URL: quickstore-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2983fff4eabbed7d0d2dd9a9e5909c691e007404431d414c2e692b9751334bdc
|
|
| MD5 |
00c5c4a673cf72b516a6c2f3ad1e3bec
|
|
| BLAKE2b-256 |
74efff278568ba4a328987c2842343c3da189cd2eab01341bcd72fe4d5ba618c
|