Q1: Simple Local File Storage
A production-grade, pip-installable Python package that offers simple local file storage backed by SQLite and optional AES-GCM encryption.
Features
- Store and retrieve files with a simple API
- Transactional operations with ACID guarantees
- Optional at-rest AES-256-GCM encryption
- Integrity verification with SHA-256
- File deduplication
- Soft and hard delete with recovery options
- Concurrency support with SQLite WAL mode
Installation
pip install q1
For encryption support:
pip install q1[crypto]
Quick Start
from q1 import Q1
# Create or open a storage location
with Q1("./my_store") as store:
# Store a file
file_id = store.put("example.txt", b"Hello, world!")
# Retrieve the file
content = store.get(file_id)
# Get file information
info = store.info(file_id)
print(f"File name: {info.name}, size: {info.size} bytes")
# List all files
for file_info in store.list():
print(f"ID: {file_info.id}, Name: {file_info.name}")
# Delete a file (soft delete by default)
store.delete(file_id)
# Undelete a file
store.undelete(file_id)
# Permanently delete
store.delete(file_id, hard=True)
Using Encryption
from q1 import Q1
from q1.crypto import AesGcmCrypto
# Create an encryption provider with a secure key
crypto = AesGcmCrypto(key=b"a" * 32) # Use a proper secure key in production!
# Open storage with encryption
with Q1("./encrypted_store", crypto_provider=crypto) as store:
# All operations work the same as before, but data is encrypted at rest
file_id = store.put("secret.txt", b"Confidential information")
content = store.get(file_id) # Automatically decrypted
Development
Setting up the development environment
# Clone the repository
git clone https://github.com/yourusername/q1.git
cd q1
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e ".[dev,crypto]"
Running tests
pytest
Type checking
mypy --strict q1
Building the package
flit build
Continuous Integration
This project uses GitHub Actions for continuous integration, running tests on:
- Python 3.9, 3.10, 3.11, and 3.12
- Windows, macOS, and Linux
The CI pipeline performs:
- Test execution with coverage reporting
- Type checking with mypy
- Package building
- Optional PyPI deployment for tagged releases
License
MIT License - See LICENSE file for details.
Metadata
Release files for q1-storage 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| q1_storage-0.1.0.tar.gz | 42.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| q1_storage-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 82.5 kB
Release files / q1_storage-0.1.0.tar.gz
| Download URL | q1_storage-0.1.0.tar.gz |
|---|---|
| Size | 42.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40cfd68c718438f9d19d6d903e5a52b22a50b370051decec02aea55db87079b4
|
|
BLAKE2b-256 checksum How to use checksums |
4923fb3895a11b1c6c12f6a2867f40440f8f78b987fbf442f805eb39e7d40038
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Release files / q1_storage-0.1.0-py3-none-any.whl
| Download URL | q1_storage-0.1.0-py3-none-any.whl |
|---|---|
| Size | 39.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b5965022d6793e0a6946122f309fc98427dc22a2135e52e0cd01c9423796c5a
|
|
BLAKE2b-256 checksum How to use checksums |
dc99e1f2303e1358873b7fc07585fecc1b40ee22f97bc89621858afc3ffc7661
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|